[6812] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 437 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 5 23:27:35 1997

Date: Mon, 5 May 97 20:00:25 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 5 May 1997     Volume: 8 Number: 437

Today's topics:
     Re: (Newbie alert!)  How to have Perl PUSH browser to a <jpearson@ket.org>
     Re: absolute novice - help me start (etta )
     Re: adding to an array within a while(<>) (Tad McClellan)
     Re: Ask a stupid question! thanks. ("John Dallman")
     Re: Can I kill a pipe? (Matthew D. Healy)
     Re: Comparing multi-line variables (Zachary Brown)
     Re: Difficulty building IO module under Solaris (Tim  Smith)
     expert systems and perl epeschko@elmer.tci.com
     File Help <peters@cco.caltech.edu>
     Re: File Help (brian d foy)
     HOW: Test for dropping of other end of TCP/IP connectio (Anthony DeRobertis)
     Re: I'm curious...  What the "o" switch is for in s/// (Tad McClellan)
     Re: Inserting list item into HTML bullet list.... (Geoffrey Hebert)
     Re: Modules/Packages in Perl <stephen+usenet@farrell.org>
     NT4, Perl 5, output to LPT1? <kentb@mdmgr.com>
     Re: Perl 5.003 ELF and Linux (Tom Vaughan)
     Re: Perl auto-replier (I R A Aggie)
     Re: Perl debugger limitation... <owt1@cornell.edu>
     PERL NT Help ! <webmaster@nuro.com>
     Re: Perl script crashes under taint checking (Randy J. Ray)
     Re: potential bug in Perl 5.003 garbage collection <owt1@cornell.edu>
     Re: Problem with uppercase reg exp (Abigail)
     rational systems inc. annoying message in perl 5.000 <pauls@pauls.seanet.com>
     Re: Script runs fine from shell, but browser doesn't re (Tad McClellan)
     Re: Singles and doubles (brian d foy)
     STRAW POLL: RFD: comp.lang.perl reorg (A. Deckers)
     Re: system commands and CGI woes (Tad McClellan)
     Re: system commands and CGI woes (Brooks Davis)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 05 May 1997 14:21:09 -0400
From: Joe Pearson <jpearson@ket.org>
To: Rich Andrews <andrewsr@bellatlantic.net>
Subject: Re: (Newbie alert!)  How to have Perl PUSH browser to a web site
Message-Id: <336E2515.7768@ket.org>

Rich Andrews wrote:
> 
> I've noticed several web sites that invoke a program with the end result
> being
> that by browser is at a new location (w/o weird codes as the URL).
> 
> For example, how could I write a simple perl script that pushes the browser
> to www.yahoo.com?
> 
> (W/o using browser tricks, etc.)
> 
> THANKS IN ADVANCE!
> -Rich

Try this:

#!/usr/bin/perl

print "Location: http://www.yahoo.com/\n\n";

-- 
Joe Pearson
jpearson@ket.org
Distance Learning Web Developer
http://www.dl.ket.org/


------------------------------

Date: Tue, 06 May 1997 01:13:45 GMT
From: etta@fyi.com (etta )
Subject: Re: absolute novice - help me start
Message-Id: <336e84d1.10142617@netnews.worldnet.att.net>



Did you assocate the .pl ext to perl.exe in windows?

Then you just go to the dir where the file you want to excuate
and type:  perl filename.pl


Hope this helps,

etta


On 5 May 1997 19:08:27 GMT, "chris" <chris.lee@globasatcom.com> wrote:

>
>ok, at the high risk of sounding (being) stupid i have a very elementary
>question.  
>
>i want to learn perl and bought the sams "teach y-self perl in 21 days" and
>it came w/ perl5 and all that crap. i am language illiterate (except back
>in college took tp but forgot it all) and have win 95 and visualc++
>software.  i installed it , but i do not know how to write/save/run the
>crapola. i typed the first example program and tried to run it the way the
>book says in the perl.exe but nothing happens.  what the hell do i need to
>do?
>
>some very patient soul, please help me get started so i can have the power
>too.
>
>chris the idiot.



------------------------------

Date: Mon, 5 May 1997 16:34:06 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: adding to an array within a while(<>)
Message-Id: <eojlk5.gl.ln@localhost>


sdm (sdm@red.seas.upenn.edu) wrote:

: Is there a way to easily add to an @array each pass through a while() loop,
: without the next pass obliterating what was there on the previous pass?
: Everything I find in my books seem to bypass/overlook this.....


push()


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: Mon, 5 May 1997 19:30:57 GMT
From: jgd@cix.compulink.co.uk ("John Dallman")
Subject: Re: Ask a stupid question! thanks.
Message-Id: <E9q3JM.5uD@cix.compulink.co.uk>

In article <336d41c5.7806797@news.ks.silkera.net>, 
a9438@mail.kscgeb.edu.tw (%,5\.&'=*x) wrote:

> As the title,this is a simple question :
> 
> If I didn't have server. Is it possible to run perl on my PC.
> I only have Win95 and perl for Win32 in my PC.

You can run perl with that, no problem. If you mean that you want to run 
perl scripts on a WWW server, you do need some extra software. See the 
references in my sig.

John Dallman, jgd@cix.co.uk. A micro-FAQ on things I keep getting asked: 
#!perl is at ftp://.../CPAN/ports/msdos/tips-tricks/hbp_403.zip, Perl for 
NT/Win 95 can be found at http://www.activeware.com, with an excellent FAQ 
file at http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html 
and no, I don't have the slightest idea what's wrong with your CGI script. 
Try http://www.perl.com/perl/faq/idiots-guide.html


------------------------------

Date: Mon, 05 May 1997 13:54:08 -0500
From: Matthew.Healy@yale.edu (Matthew D. Healy)
Subject: Re: Can I kill a pipe?
Message-Id: <Matthew.Healy-0505971354080001@pudding.med.yale.edu>

In article <E9F9Hx.6BL@bcstec.ca.boeing.com>, ced@bcstec.ca.boeing.com
(Charles DeRykus) wrote:

> The mail won't be sent until there's an eof on the data stream. So you 
> could kill off the process anytime prior, e.g, 

Wouldn't that generate a dead.letter file?

Seems to me the right answer is: get and validate all the data to be
emailed first, then send it in batch mode if and only if you decide
you want to send it...
---------
As of 02 May 1997, 973 days till Y2K....
Matthew.Healy@yale.edu
http://paella.med.yale.edu/~healy
"But I thought it was pointed at the rabbit *between* my feet!"
---------
Help a victim of severe email harrassment, see
http://www.geocities.com/~hitchcockc/story.html#fund
---------


------------------------------

Date: 5 May 1997 21:20:14 -0400
From: zbrown@lynx.dac.neu.edu (Zachary Brown)
Subject: Re: Comparing multi-line variables
Message-Id: <5km10e$gvr@lynx.dac.neu.edu>

In article <5kl6ce$mop@news.atlantic.net>,
Chip Salzenberg <chip@pobox.com> wrote:
>According to zbrown@lynx.dac.neu.edu (Zachary Brown):
>>Given two variables $a and $b containing multiple lines of ascii text, how
>>could perl locate all the start and end indices of the words or groups of
>>words that are different in one from the other and vice versa? 
>
>That's a complex task, and you'd have to be a bit more precise to get
>an answer.  If I were doing it, I'd write two temporary files with one
>word per line, then open(FOO, "diff $T1 $T2 |") and parse <FOO>.

Would this be a good start? It reads two filenames from the command line, 
compares the files, and outputs them with differences marked. It still 
has problems, I think.

Zack

-----------------------------------
#!/usr/bin/perl

$| = 1;

$n1 = shift;
$n2 = shift;

# read in the files
open(I1, "<$n1");
open(I2, "<$n2");
@n1 = <I1>;
@n2 = <I2>;
close(I1, "<$n1");
close(I2, "<$n2");

# create copies containing the file data
@f1 = split(' ', $n1[0]);
@f2 = split(' ', $n2[0]);

# modify the arrays to have one word per line
grep(s/\s+/\n/g, @n1, @n2);

# create temporary files with one word per line
open(O1, ">$n1.tmp");
open(O2, ">$n2.tmp");
print O1 join("\n", @n1);
print O2 join("\n", @n2);
close(O1);
close(O2);

# do a diff on the word-per-line files
open(FOO, "diff $n1.tmp $n2.tmp |");
@dif = <FOO>;
chomp @dif;
close(FOO);

foreach(@dif) {
    next if /^[-<>]/;
    if(/(.*)d/) {
        @com = split(',', $1);
        foreach $num (@com) {
            $f1[$num - 1] = "\[\[$f1[$num - 1]\]\]";
        }
    }
    elsif(/a(.*)/) {
        @com = split(',', $1);
        foreach $num (@com) {
            $f2[$num - 1] = "\{\{$f2[$num - 1]\}\}";
        }
    }
    elsif(/(.*)c(.*)/) {
        @com = split(',', $1);
        foreach $num (@com) {
            $f1[$num - 1] = "\[\[$f1[$num - 1]\]\]";
        }
        @com = split(',', $2);
        foreach $num (@com) {
            $f2[$num - 1] = "\{\{$f2[$num - 1]\}\}";
        }
    }
}

print join(" ", @f1), "\n";
print join(" ", @f2), "\n";



>Chip Salzenberg      - a.k.a. -      <chip@pobox.com>
>       "Men of lofty genius are most active
>        when they are doing the least work."
>                           -- Leonardo da Vinci




------------------------------

Date: 5 May 1997 11:33:54 -0700
From: trs@azstarnet.com (Tim  Smith)
Subject: Re: Difficulty building IO module under Solaris
Message-Id: <5kl96i$jg@web.azstarnet.com>
Keywords: perl5 solaris gcc IO

[ CC to poster ]

In article <3368AE6A.3B1C@stonehill.edu>,
Aaron Bennett  <abennett@stonehill.edu> wrote:
>Hello:
>
>I'm having a hair-pulling time installing the CPAN IO:: library into
>Perl 5.003 under Solaris 2.5.1 with GCC.
>
>The ugliness continues for about six pages.
>
>Does anyone know what stupid thing I'm doing wrong?

Aaron,

I only got it to work after building perl5 w/ dynamic loading.  To do
that, I had to:

$ PATH=/usr/ccs/bin:/opt/gnu/bin:/bin:/usr/bin:/usr/local/bin; export PATH

so that the Sun 'as' and 'ld' are used, not the GNU ones.  Then when I
ran Configure, I forced it to use 'gcc' instead of 'cc' as the compiler.
The rest of the questions I answered default.

Once the perl was built with dynamic loading, everything else went as
planned.

Tim



------------------------------

Date: Mon, 05 May 1997 17:01:15 -0600
From: epeschko@elmer.tci.com
Subject: expert systems and perl
Message-Id: <862869094.29307@dejanews.com>


hey --

I was wondering if someone has ever glued an expert system into perl
(such that you can define rules and have those rules turn into
statements.)

Or, is there a good public domain Expert system I could 'do the glue'
for?

Thanks much,

Ed

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

Date: Mon, 05 May 1997 17:12:10 -0700
From: "Keith A. Peters" <peters@cco.caltech.edu>
Subject: File Help
Message-Id: <336E775A.497A@cco.caltech.edu>

I have an inetrresting problem. I have a script which when running opens
a file for writing fine (it creates it) but won't send any data to it.
This is being done under Windows NT 4.0. Any ideas on the source of the
problem would be appreciated.

Thanx
Keith A. Peters


------------------------------

Date: Mon, 05 May 1997 22:27:07 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: File Help
Message-Id: <comdog-0505972227070001@nntp.netcruiser>

In article <336E775A.497A@cco.caltech.edu>, "Keith A. Peters"
<peters@cco.caltech.edu> wrote:

> I have an inetrresting problem. I have a script which when running opens
> a file for writing fine (it creates it) but won't send any data to it.
> This is being done under Windows NT 4.0. Any ideas on the source of the
> problem would be appreciated.

well, with the little information that you have given there can be only
one answer:  it's a bug in NT.

perhaps if you provided a more cogent analysis of the problem a 
more helpful answer could be given.  once you've done that, we can
decide if you have an interesting problem or not.

-- 
brian d foy                              <URL:http://computerdog.com>                       
unsolicited commercial email is not appreciated


------------------------------

Date: Mon, 05 May 1997 20:40:34 -0400
From: derobert@erols.com (Anthony DeRobertis)
Subject: HOW: Test for dropping of other end of TCP/IP connection?
Message-Id: <derobert-ya02408000R0505972040340001@news.erols.com>


If I have a TCP/IP connection in PERL, how can I test if it's been dropped
by the remote end?

I don't want it to freeze up while doing <CONN>. So, my seconds question is
how do I tell PERL to read whatever is availible from a TCP/IP socket?

I know <CONN> will stop is the connection is closed, but until that time it
is frozen.


------------------------------

Date: Mon, 5 May 1997 17:11:31 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: I'm curious...  What the "o" switch is for in s///
Message-Id: <jullk5.9q.ln@localhost>

Pascal Houde (houde@fox.cisti.nrc.ca) wrote:
: I'm interpreting another's program and I saw it was using the "o" option
: in s/// but I cannot figure out what it does special.  I even read in
: the Perl book but it's not trivial.  Can you explain it to me what it
                         ^^^^^^^^^^^

But it _is_ trivial. 'Course the explanation may be non-trivial, can't
tell because you didn't tell us what book you're talking about.

Anyway, the authoritative source for info on perl are the man pages
that are included with the distribution.

This should always be the first place you look. Even before looking
in any book.

The perlop man page says this about s///:


---------------------------
=item s/PATTERN/REPLACEMENT/egimosx

Searches a string for a pattern, and if found, replaces that pattern
with the replacement text and returns the number of substitutions
made.  Otherwise it returns false (0).

If no string is specified via the C<=~> or C<!~> operator, the C<$_>
variable is searched and modified.  (The string specified with C<=~> must
be a scalar variable, an array element, a hash element, or an assignment
to one of those, i.e. an lvalue.)

If the delimiter chosen is single quote, no variable interpolation is
done on either the PATTERN or the REPLACEMENT.  Otherwise, if the
PATTERN contains a $ that looks like a variable rather than an
end-of-string test, the variable will be interpolated into the pattern
at run-time.  If you only want the pattern compiled once the first time
the variable is interpolated, use the C</o> option.  If the pattern
evaluates to a null string, the last successfully executed regular
expression is used instead.  See L<perlre> for further explanation on these.

Options are:

    e   Evaluate the right side as an expression.
    g   Replace globally, i.e. all occurrences.
    i   Do case-insensitive pattern matching.
    m   Treat string as multiple lines.
    o   Only compile pattern once.

 ...
---------------------------



See where it talks about the 'o' option in the third paragraph.

That's pretty much it. 




: does with an easy example.


OK.

perl builds a little machine to do the pattern matching for regexs.

Without the 'o', the machine is rebuilt anew for each iteration of
the loop (assuming the regex is in a loop. The 'o' option isn't
much good if the machine is already only being built once).

This is slow.

If your pattern has a variable in it that *does not change for the
life of your script*, then the 'o' will make it run faster.

If you have a constant pattern (ie. with nothing in it that can change)
then 'o' has no effect.

I have seen many silly CGI scripts with something like:

s/+/ /go;  where the 'o' is completely unnecesary, and doesn't do anything...


Examples:

1)
$pat = 'abc';
print "matched\n" if /$pat/;  # get identical results with 'o', because
                              # the machine only gets built once anyway

2)
@pat = ("abc", "def", "ghi");
foreach $pattern (@pat) {
   print "matched\n" if /$pat/; # can't use 'o' here. If you do, then it
                                # will try and match 'abc' for *every*
                                # iteration of the loop
}


3)
$pat = 'abc';
while (<>) {
   print "matched\n" if /$pat/; # slow as molasses, you want to use 'o' here
}


4)
$pat = 'abc';
while (<>) {
   print "matched\n" if /$pat/o; # ahhh, much faster (if you have lots
                                 # of loop iterations)
}



: Thanks in advance.

You're welcome, after the fact ;-)


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: Tue, 06 May 1997 02:06:42 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: Inserting list item into HTML bullet list....
Message-Id: <5km2km$bvb$1@news3.microserve.net>

Try signature below.  My test site.  I have a script there
that keeps a soccer roster add deletes and changes 
from the web.  I use Jersey number to sequence.
You can select your last name (I hope).

Follow path to perl cross reference.  Select the script
for roster.cgi.  It is mine, you are welcome to use it for
your purposes.  



"Jeff Keller" <jakeller@ucsd.edu> wrote:


>Ok, I'm trying to both learn Perl and save myself time in the same weekend
> and I've run across some difficulties ;-)

>What I'm trying to do is write a Perl script to automatically add 
>and delete people from the high school alumni list I've kept for the past several years.. 

>I can get it to delete people just fine.. but when I want to 
>add someone's entry, I want it to go in the right spot alphabetically.. 
>but I can't even think of a logical way to do it, let alone use Perl to do it <grin>

>An example of the page I'd want to add an entry to is:
>http://lostworld.pair.com/smhs/years/1994.html

>Say I want to have the script put in  "Bob Jones '96 (and all that follows)" -- it needs 
>to go in the right place!

>So if anybody can help, or if you need more info, don't hesitate to write me at jakeller@ucsd.edu -- if you post publicly here be sure to copy me in on the message too..

>Many thanks -- 

>Jeff Keller

> ._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> Jeff Keller                          
> University of California, San Diego
> Webmaster, UCSD Bookstore ---------> http://www-bookstore.ucsd.edu
> Webmaster, PowerWatch -------------> http://www.powerwatch.com
> Personal Home Page ----------------> http://lostworld.pair.com
> E-mail address --------------------> jakeller@ucsd.edu

-------  signature  ----------

Check out the Perl site!

http://www.microserve.net/~soccer/

use password perlmisc

Geat tool for Developers>



------------------------------

Date: Tue, 6 May 1997 01:02:05 GMT
From: stephen farrell <stephen+usenet@farrell.org>
Subject: Re: Modules/Packages in Perl
Message-Id: <87k9ld5s6q.fsf@phaedrus.uchicago.edu>

rjray@tremere.ecte.uswc.uswest.com (Randy J. Ray) writes:

> stephen farrell <stephen+usenet@farrell.org> writes:
> > "Neil D. Quiogue" <neil@iphil.net> writes:
> > > 2. INC
> > > 
> > > use Exporter;
> > > 
> > > @ISA = (Exporter SuperClass);
> > > 
> > > require "/somedirectory/myConf.conf";
> > > 
> > > $INC{'$HOME/SuperClass.pm'} = 1;
> > 
> > yow.  Don't do this with @INC because (a) it is--or *was*, rather;)--
> > an array, not a hash (b) it's weird.  Use
> > 
> > 	use lib "dir/ectory";
> > 
> > instead, or else the way I mentioned above.
> 
> Altering %INC and adding a directory to the search path are different beasts.
> 
> %INC and @INC are different variables-- the former maps loaded libraries to
> their full paths. For example, if you "use English;", and your perl libraries
> start at /usr/local/lib/perl5, then $INC{'English.pm'} will equal
> "/usr/local/lib/perl5/English.pm". 

Thanks -- my bad!

>@INC, on the other hand, is an ordered
> list of directories to search for requested libraries.

Right...

> This said, the use of
> %INC above is still wrong, since '$HOME/SuperClass.pm' is not a good key (not
> to mention that the quoting will supress expansion of $HOME, which the writer
> probably meant to be $ENV{HOME} anyway), and "1" is not a good path for the
> resolved location.
> 
> On the plus side, "use lib '/foo';" is the preferred method of adding dirs to
> the search path.

I think what Neil wants to do (if I now understand him correctly) is
affect the load path with some variables, such as $HOME which he is
getting from a config file.  It would seem likely that this effect
could be afforded by "use lib './foo'" type construct (if he really
meant $ENV{HOME}, then the relative link might be just the right
thing).  One place to look might be at DynaLoader for this.


--steve farrell

> 
> Randy
> -- 
> ===============================================================================
> Randy J. Ray -- U S WEST Technologies IAD/CSS/DPDS         Phone: (303)595-2869
>                 Denver, CO                                     rjray@uswest.com
> "It's not denial. I'm just very selective about the reality I accept." --Calvin
> ===============================================================================



------------------------------

Date: Mon, 05 May 1997 16:41:21 -0600
From: Kent Brewster <kentb@mdmgr.com>
Subject: NT4, Perl 5, output to LPT1?
Message-Id: <862868008.28179@dejanews.com>


How do I use Perl 5 to make the phrase "hello, world" come out of the
printer at LPT1, on an NT4 server?

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

Date: 5 May 1997 23:14:01 GMT
From: tommy@best.com (Tom Vaughan)
Subject: Re: Perl 5.003 ELF and Linux
Message-Id: <5klpjp$qe2$2@nntp1.ba.best.com>


Upgrade to RedHat 4.1. Perl 5.003 (source and a pre-compiled ELF binary)
come with it. Both as rpm's.

J. Roemer (jroemer@spiderpub.com) wrote:
: Could somebody please direct me to the
: Perl 5.003 ELF package for Linux?
: I'm running Redhat 3.0.3, and I wish
: to upgrade my version of Perl.

: Thanks much!

: Jim Roemer

--
Tom Vaughan <tommy@best.com>


------------------------------

Date: Mon, 05 May 1997 21:25:42 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: Perl auto-replier
Message-Id: <fl_aggie-ya02408000R0505972125430001@news.fsu.edu>

In article <5kllj6$ldb$1@dartvax.dartmouth.edu>,
Ronald.J.Kimball@dartmouth.edu (Chipmunk) wrote:

+ In article <336DBD00.91D7A60@absyss.fr>
+ Douglas Seay <seay@absyss.fr> writes:

+ > I don't want to say that rudeness is the only way, but the hordes of
+ > unread newbies grows old quick.

+ And I ask again, will being rude solve the problem?
+ No, it won't.  No matter how rude you are, we will continue to have
+ newbies asking foolish questions.  As I see it, being rude gets you
+ nothing.

Call me a BOFH, but there is a certain gratification...

James

-- 
Consulting Minister for Consultants, DNRC

To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


------------------------------

Date: 05 May 1997 22:01:13 -0400
From: Owen Taylor <owt1@cornell.edu>
Subject: Re: Perl debugger limitation...
Message-Id: <lzpvv52wba.fsf@cu-dialup-0725.cit.cornell.edu>


>    I was trying the Perl debugger (perl -d) via another program
> using a Unix pipe, however not matter what I do, even if the
> pipe is setup the output of perl5db.pm always kind of flows
> out of the pipe instead of inside the pipe to use some plumbing
> terms. 

You probably know more about the guts of perl5db.pl than I do,
but to launch into an explaination of the obvious...

The perl debugger can't very well debug a program that writes to
stdin/stdout if it's using them itself.  (Or so it seems to me.) So to
get around this, the perl debugger opens /dev/tty to interact with the
user.  However, it looks like it's possible to set the TTY in a
 .perldb file, so you should be able to work out a solution with
ptty's. You might to look at how the perl debugger mode for Emacs
works as an example of programmatic interaction with perl5db.pl.

Hope this helps some,
                                        Owen


------------------------------

Date: Mon, 05 May 1997 21:40:52 -0500
From: Paul Zahnle <webmaster@nuro.com>
Subject: PERL NT Help !
Message-Id: <336E9A34.1947@nuro.com>

Hey All,

In NT Land, Were having trouble passing an Arg. to our script.
the string will be:
/user-bin/ourscript.pl?file_number

we need to delete the file using  unLink

here's our script:

print "HTTP/1.0 200 OK\n";
print "Content-type:text/html\n\n";

print "<html>";
print "<head>";
print "<title>Test Perl Script</title>";
print "</head>";
print "<body>";
print "<h1>Removing File</h1>";

if( !defined($ENV{"QUERY_STRING"})){
	&pk_error("No File name to remove\n");
}

$input=$ENV{"QUERY_STRING"};

print $input;

unlink 'C:\InetPub\ftproot\staging\@input';

// this line works if we hard code the file name but we need to
// add a wild card to the beginning and end of the arg like,
// *file_number*
 
print "</body>";
print "</html>";
exit;

Any help will be greatly appreciated and bring you much good 
Web-Karma........

Sincerely,
Paul Zahnle	
nuro@toontown.lucent.com
ps:anyone know of a good PERL for NT resource ?!?!?!


------------------------------

Date: 05 May 1997 13:54:58 -0600
From: rjray@tremere.ecte.uswc.uswest.com (Randy J. Ray)
Subject: Re: Perl script crashes under taint checking
Message-Id: <uowwwpd8zjh.fsf@tremere.ecte.uswc.uswest.com>

jeremy+jindaolese@blackbox.ylasia.com.tw (Jeremy Anderson) writes:

> I have a small, fairly straightforward Perl script which reads in data, stores
> said data in a largish (2 MB) associative array, then prints the data out to
> text or HTML files.  Really boring stuff.
> 
> This script runs fabulously, unless taint checking is turned on, in which case
> perl puts out a segmentation fault about 2 minutes into the execution of the
> script.  I want the script to run as the backend of a CGI program one of these
> days, and I don't see any good way to get around taint checking.

You don't tell us a great deal about *what* exactly the program does, both in
general and specifically to the data.

I can say this: the data is from an external source (a file), and as such under
taint-checking is considered tainted. If you are using the IO::* modules, and
are *absolutely certain* of the integrity of the file itself, the IO::File
class has a method called untaint(). Read about it in the man page. Otherwise,
you will have to wash the data as it is read (or before it is used in a
critical area, at least).

Randy
-- 
===============================================================================
Randy J. Ray -- U S WEST Technologies IAD/CSS/DPDS         Phone: (303)595-2869
                Denver, CO                                     rjray@uswest.com
"It's not denial. I'm just very selective about the reality I accept." --Calvin
===============================================================================


------------------------------

Date: 05 May 1997 21:46:53 -0400
From: Owen Taylor <owt1@cornell.edu>
Subject: Re: potential bug in Perl 5.003 garbage collection
Message-Id: <lzrafl2wz6.fsf@cu-dialup-0725.cit.cornell.edu>


Actually, I don't think your code is doing anything like
what you think it is. The major problem is statements like

   ${self->{aHash}}{1}

In the construct ${ ... }, what goes inside the curly braces should
usually be a valid perl expression returning a reference.  (You'd have
seen a ton of warnings about this if you had used -w). So,

   ${$self->{aHash}}{1}

does what you expect. But the normal way of writing this is

$self->{aHash}->{1}

(Or even, $self->{aHash}{1}).

I wrote a lot of complicated expressions when I first started
using Perl5, but eventually figured out that everything that
one really wants to do can be expressed pretty simply.

Regards,
                                        Owen



------------------------------

Date: Mon, 5 May 1997 18:42:03 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Problem with uppercase reg exp
Message-Id: <E9q1A4.9y6@nonexistent.com>


On Mon, 05 May 1997 14:54:37 +0200, Eike Grote wrote in
comp.lang.perl.misc URL: news:336DD88D.446B@theo.phy.uni-bayreuth.de:
++ 
++ 3)   $x =~ s/^\ba-z/A-Z/g;
++ 
++      better forget about this one ...
++ 
++      I think you wanted something like this:
++ 
++      $x =~ s/\b([a-z])/\u$1/g;

But this doesn't capitalize accented letters. Use:
        $x =~ s/\b(\w)/\u$1/g;



Abigail


------------------------------

Date: 5 May 1997 23:46:49 GMT
From: "paul spitalny" <pauls@pauls.seanet.com>
Subject: rational systems inc. annoying message in perl 5.000
Message-Id: <01bc59ae$98225660$313d4789@pollux.direcpc.net>

Hello Perl usrs,
I am using perl 5.000 from a dos prompt (I know, I'm not up to date).
Whenever I run a script I get an annoying message that goes as follows:

	DOS/4GW Protected Mode Run-time version 1.9
	Copyright (c) Rational Systems, Inc. 1990 - 1993


DOes anyone out there in pERL land know the change I need to make to get my
scripts to run without this annoying message????

Thanks

in other words

s/annoying message//;





------------------------------

Date: Mon, 5 May 1997 16:25:37 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Script runs fine from shell, but browser doesn't receive variables
Message-Id: <h8jlk5.vj.ln@localhost>


Jeffrey Morgan (myxx@sel-mor.com) wrote:
: I have a script that simply reads a directory, stores the file names
: in an array, uses those filenames to open a string of text files and
: print the output to the browser that calls the script.

: From the shell it works great, but from the browser I get not out put.


The very first Frequently Asked Question in the Perl FAQ, part 9,
which deals with "Networking" (even though it is not a Perl question
at all, but a CGI question best asked in one of the CGI newsgroups
such as comp.infosystems.www.authoring.cgi):


----------------------
=head2 My CGI script runs from the command line but not the browser.  Can you help me fix it?

Sure, but you probably can't afford our contracting rates :-)

Seriously, if you can demonstrate that you've read the following FAQs
and that your problem isn't something simple that can be easily
answered, you'll probably receive a courteous and useful reply to your
question if you post it on comp.infosystems.www.authoring.cgi (if it's
something to do with HTTP, HTML, or the CGI protocols).  Questions that
appear to be Perl questions but are really CGI ones that are posted to
comp.lang.perl.misc may not be so well received.

The useful FAQs are:

    http://www.perl.com/perl/faq/idiots-guide.html
    http://www3.pair.com/webthing/docs/cgi/faqs/cgifaq.shtml
    http://www.perl.com/perl/faq/perl-cgi-faq.html
    http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html
    http://www.boutell.com/faq/
----------------------



[snip]

: Any ideas?

Try reading the FAQ?  ;-)


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: Mon, 05 May 1997 20:51:18 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Singles and doubles
Message-Id: <comdog-0505972051180001@nntp.netcruiser>

In article <336E63D1.528C@inorbit.com>, mrchristopher@inorbit.com wrote:

> How can I define a string that contains stuff to be evaluated so that it
> isn't evaluated the first time it's defined but rather when it's used
> inside double quotes..

> $stuff='$this+$that';
> $that=5;
> while <FILE> {
> $this++;
> $theanswer="10+$stuff";
> }

maybe this is the behaviour that you want?:

#!/usr/bin/perl -w

use strict;

my $stuff  = '$this+$that';

my $that   = 5;
my $this   = 6;  # wrap your loop around this later

my $result = eval("10+$stuff");

print $result;

__END__

-- 
brian d foy                              <URL:http://computerdog.com>                       
unsolicited commercial email is not appreciated


------------------------------

Date: 6 May 1997 02:13:45 GMT
From: I-hate-cyber-promo@man.ac.uk (A. Deckers)
Subject: STRAW POLL: RFD: comp.lang.perl reorg
Message-Id: <slrn5mt4up.9b.I-hate-cyber-promo@news.rediris.es>

[NB: followup to poster]

In order to gage which groups would have a fighting chance of passing a
CFV vote, I would like to ask you to participate in an INFORMAL ballot.

This is NOT a vote to decide upon the creation of these groups, but a
non-binding consultation to assist the proponents in deciding which
groups should be included in the official RFD. Vote on the proposed
group names and subject areas ONLY. At this stage, I'm not interested
whether or not you agree with the moderation provisions of the charter.

Please take into account that the script that will process your vote is
a quick hack I've just thrown together in a few minutes. It is not very
sophisticated, and will not deal with blank or erroneous ballots
particularly graciously. It will however send you an acknowldgement
including what it thinks your vote was, so if you think there was an
error somewhere, vote again, using the same From and Reply-To addresses
(the script prefers the Reply-To address over the from).

Whatever else you do, PLEASE include the words "straw poll" (case is
not significant; the quotes don't matter) in the subject header, since
that's how my email filtering software will pick out ballots and pipe
them to the script.

Do NOT publish your vote in the group; send it to me by EMAIL.

The ballot will close on Saturday, 10th of May sometime in the morning
(as soon as I'm awake enough to logon).

Now for the vote: please fill in either YES or NO in the space provided
below. Your vote MUST be between the square brackets.  Don't alter the
line in any other way. You may add a quote mark at the beginning of the
line, but if you use some silly quoting mechanism that will make the
lines wrap, please edit them manually so they don't.

I vote [     ] to comp.lang.perl.data-structure
I vote [     ] to comp.lang.perl.inter-process
I vote [     ] to comp.lang.perl.programmer
I vote [     ] to comp.lang.perl.regex

If you would like to suggest any alternative/additional groups, please
complete the group name below (one group per line). If you don't,
please delete the following line altogether.

I vote [ YES ] to comp.lang.perl.

Don't bother voting for comp.lang.perl.{cgi,www,wizards,guru,etc.}
since I will not include any such thing in the official RFD. I am
confident that all the proponents share this position.

I repeat that if the vote ack you receive from the script doesn't
correspond to your vote, vote again using the same address. If all
else fails (and I see no reason why it should), mail me your vote
without the words "straw poll" in the subject, and I'll process it
manually.

Multiple votes will only be counted once, so Netscape users can breathe
easy. Hit that send button as many times as you want. :-)

NB: the dodgy looking address in the headers is perfectly good. Please
use it.

Cheers,

Alain



------------------------------

Date: Mon, 5 May 1997 17:24:59 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: system commands and CGI woes
Message-Id: <rnmlk5.is.ln@localhost>

Mike (mdickson@cyberus.ca) wrote:

[ snip ]

: Conversly, if you can capture the return from the touch command (ie,
: prevent its writing to STDOUT or STDERR), I could to the write and the
: test on one line.

You seem to be confusing the return value of a command with the _output_
of the command.


$touched = system "touch foobar.html >/dev/null 2>1";

print "Uh oh!\n" if $touched;  # returned an error


You can use normal bourne shell syntax for redirecting the output
to the bit bucket. (see How can I capture STDERR from an external 
command? in the Perl FAQ, part 8)


: Thanks for the help.

Hope I did help ;-)


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: 6 May 1997 00:44:10 GMT
From: brdavis@orion.ac.hmc.edu (Brooks Davis)
Subject: Re: system commands and CGI woes
Message-Id: <5klusq$mec$1@cinenews.claremont.edu>

Mike (mdickson@cyberus.ca) wrote:
: How can I ensure that a directory is writable by the EUID?  I need to
: ensure that a given path is writable for the `touch` command in my CGI
: script before I try and use it.

if( -w $path ) {
  # whatever you want to do to the file
} else {
  # whatever you do if you can't work with the file
}

-w uses EUID and -W uses RUID

I can never remember what file test operators there are so I just use my
handy copy of the "Perl 5 Desktop Reference" which costs only $7.

: Conversly, if you can capture the return from the touch command (ie,
: prevent its writing to STDOUT or STDERR), I could to the write and the
: test on one line.

If you want to do it that way you could do simply do this:

$touch_output = `touch $path 2>&1`;

and then use that value.  The trick is that the 2>$1 causes the shell to
redirect all STDERR to STDOUT for easy processing.

-- Brooks


------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 437
*************************************

home help back first fref pref prev next nref lref last post