[8919] in Perl-Users-Digest
Perl-Users Digest, Issue: 2536 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 7 22:07:55 1998
Date: Thu, 7 May 98 19:00:34 -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 Thu, 7 May 1998 Volume: 8 Number: 2536
Today's topics:
Re: [q] user modified module search path <rootbeer@teleport.com>
About perl online doc <chenm@163.net>
Re: About perl online doc <rootbeer@teleport.com>
Re: chdir in Win NT (Martien Verbruggen)
Re: COUNTING DAYS UNTIL 2000 <lr@hpl.hp.com>
Re: Does anybody understand $File::Find::prune ?? <riepel@Zathras.Stanford.EDU>
Re: Does anybody understand $File::Find::prune ?? <tchrist@mox.perl.com>
Re: Ever Wonder Why Not Everyone Uses Modules? <p-ciccone@usa.net>
Re: failing to interpret * on NT command line (Martien Verbruggen)
Re: Help Please: How Do I Test A String (TomH)
how do i do this with a regular expression? (Todd)
Re: how do i do this with a regular expression? <rootbeer@teleport.com>
how do i keep range operator in list 'mode'?? (Gregory Coleman)
Re: How to clear browser Cache with perl <rootbeer@teleport.com>
Re: How to clear browser Cache with perl <ljz@asfast.com>
how to retrieve a string from an html page brz@hotmail.com
Re: how to retrieve a string from an html page <rootbeer@teleport.com>
MEmeory problem IN CGI bidyut@yahoo.com
Re: MEmeory problem IN CGI <rootbeer@teleport.com>
Netscape/Perl trouble <rswillco@acs.ucalgary.ca>
Re: Padding a string to be a fixed length <rootbeer@teleport.com>
Re: Passing long command line to shell, best way? <rootbeer@teleport.com>
Re: perl scripts dealing with /etc/passwd <webmaster@fccjmail.fccj.org>
Re: perl scripts dealing with /etc/passwd <rootbeer@teleport.com>
Re: Perl, SSI, and Cookies <rootbeer@teleport.com>
Re: pop/push,shift/unshift ????? (Martien Verbruggen)
Re: pop/push,shift/unshift ????? (Jon Bell)
Re: Question: Is Perl an acronym? <tchrist@mox.perl.com>
Re: Question: Is Perl an acronym? (Craig Berry)
Re: Question: Is Perl an acronym? <ljz@asfast.com>
Re: Question: Is Perl an acronym? <rootbeer@teleport.com>
Re: Setting Environment Variables (Martien Verbruggen)
Re: Win95 Perl scripts DONT WORK on UNIX (Ron Heiby)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 08 May 1998 00:28:42 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Matthias Fischmann <fis@mpi-sb.mpg.de>
Subject: Re: [q] user modified module search path
Message-Id: <Pine.GSO.3.96.980507172755.25820C-100000@user2.teleport.com>
On 7 May 1998, Matthias Fischmann wrote:
> What I am looking for is some sort of environment variable
> representing @INC and beeing imported by perl from the executing
> shell.
Would that be PERL5LIB? See the perlrun manpage for details. Hope this
helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 08 May 1998 09:18:41 +0900
From: chenmin <chenm@163.net>
Subject: About perl online doc
Message-Id: <35524F61.D4469A44@163.net>
Hi,
I'm a beginner of Perl.Where can I get some online perl document or some
related sources?
Thanks
CM
------------------------------
Date: Fri, 08 May 1998 01:45:53 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: chenmin <chenm@163.net>
Subject: Re: About perl online doc
Message-Id: <Pine.GSO.3.96.980507184326.25820M-100000@user2.teleport.com>
On Fri, 8 May 1998, chenmin wrote:
> I'm a beginner of Perl.Where can I get some online perl document or some
> related sources?
Usually, in the first place you look. There are docs on Perl just about
everywhere. Is there a more obvious place where we should put information
on Perl so that you would have found it before posting? That would be very
helpful to know. Thanks!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 7 May 1998 23:43:15 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: chdir in Win NT
Message-Id: <6itguj$nff$1@comdyn.comdyn.com.au>
In article <6in0nu$6mt$1@news.netvision.net.il>,
"Oren Levine" <olevine@clalit.co.il> writes:
> chdir ($basedir);
> However, chdir won't work. It's supposed to 'chdir' from "c:inetpub\scripts"
> to
> "c:\inetpub\wwwroot\somedirectory", but it doesn't
Try something like
chdir($basedir) || die "Cannot chdir to $basedir: $!";
To get some information about why it fails. If this is a CGI, then you
should be able to read that output in your web server's error log. You
could of course also use CGI and CGI::Carp, if you want debugging to
be a bit more clever.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | We are born naked, wet and hungry. Then
Commercial Dynamics Pty. Ltd. | things get worse.
NSW, Australia |
------------------------------
Date: Thu, 7 May 1998 17:08:17 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: COUNTING DAYS UNTIL 2000
Message-Id: <6itidh$kds@hplntx.hpl.hp.com>
Art Cohen wrote in message <6itf0h$8vf@fridge.shore.net>...
...
>Yuk. Date::Manip is a huge piece of code, just a little too "robust"
(imo)
>than needed for a simple application like this. (Especially if it's
going
>to be part of a web page, where the time to load Date::Manip would
>seriously affect download time).
...
This point should be made more often in the module discussion. Except
when mod_perl or fastcgi is used, the load and compile time of a typical
Perl CGI application is likely to dominate the compute time and to be
quite noticeable. (That's why C is better than Perl for webcounters :-)
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: 07 May 1998 16:53:42 -0700
From: Rob Riepel <riepel@Zathras.Stanford.EDU>
Subject: Re: Does anybody understand $File::Find::prune ??
Message-Id: <mvy90od3aex.fsf@Zathras.Stanford.EDU>
"Les Woolsey" <lwoolsey@innovative.ca> writes:
> I'm doing using File::Find and calling the find function to scan all the
> files in a directory. I don't want to go below the current directory level
> so inside the "wanted" routine I'm setting $File:Find:prune=1;.
>
> On NT under 5.003_07 this works just fine.
>
> But under 5.004_04 under AIX I get entirely different results. I have to
> wait until I get passed a directory that is below the current one, then set
> prune=1 as above. If I set it sooner, (ie on the current directory), I
> don't get the files in this directory.
>
> Either the functionality of this code has changed between revisions of Perl
> or it's a variation in the operating systems. Does anybody know which?
Yup, some of my toys broke on 5.00<something>. I ended up changing
-d _ && ($prune = 1);
to
-d _ && $_ ne "." && ($prune = 1);
and everything works again.
I have a feeling that this check needs to be in the module, but I don't
have the time to figure where to put it.
--
Rob Riepel -- riepel@Stanford.EDU
Systems Programmer, Stanford University Networking & Communications Systems
---------------------------------------------------------------------------
http://geek.stanford.edu (650) 725-7577
------------------------------
Date: 8 May 1998 00:29:47 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Does anybody understand $File::Find::prune ??
Message-Id: <6itjlr$qvf$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Ron Savage <rpsavage@ozemail.com.au> writes:
:I think you'll find that File::Find doesn't call your wanted() if there are no
:files in the directory.
Funny, doesn't look that way to me.
$ mkdir /tmp/empty
$ perl -MFile::Find -le 'find sub { print $File::Find::name }, "/tmp/empty"'
/tmp/empty
--tom
--
I just hate to be pushed around by some fucking machine. - Ken Thompson, on the i960
------------------------------
Date: 07 May 1998 18:47:14 -0700
From: Paolo Ciccone <p-ciccone@usa.net>
Subject: Re: Ever Wonder Why Not Everyone Uses Modules?
Message-Id: <wkiunhpm8t.fsf@usa.net>
>>>>> "JP" == John Porter <jdporter@min.net> writes:
>> How is encouraging people to write there own programs greedy or
>> in any way spoiled?
JP> Paolo's comment wasn't directed at people who refuse to use
JP> modules. If anything, it's the people (like me) who build on
JP> the work of others without a second's thought, who should be
JP> called spoiled. I thank the gods for the wealth of modules
JP> available.
Correct, my comment was directed to one poster that complained about
the idea of the modules ("I'm a programmer, I can code it myself") or
the fact that they are, in his opinion, not quality code. My point was
that since they are free and quite well documented and maintained in
CPAN, criticizing them is really inappropriate.
--Paolo
------------------------------
Date: 7 May 1998 23:54:01 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: failing to interpret * on NT command line
Message-Id: <6ithip$nj8$1@comdyn.comdyn.com.au>
In article <6in2nb$7ls$1@m5.stny.lrun.com>,
"Tim Gray" <tgray@smlny.com> writes:
> I am trying, in WinNT, to do the simple one liner
>
> perl -pi.bak -e 's/foo/bar/;' *
>
> and it gives me
>
> Can't open *: No such file or directory
>
> I also tried *.* and *.txt. I could have sworn I have done this before. I
> am using Mr. Sarathy's port of 5.004_02. Any suggestions? Thanks.
This is a subject that comes up regularly on this group. The NT and
DOS shells don't expand the * for you. The ActiveState perl,
therefore, will always expand that * for you, and then continue. The
GS port doesn't do this by default, I believe, but it can be
configured to do it for you. It probably is covered by the
documentation that comes with it :)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use being
NSW, Australia | a damn fool about it.
------------------------------
Date: Wed, 06 May 1998 22:07:13 GMT
From: beans@bedford.net (TomH)
Subject: Re: Help Please: How Do I Test A String
Message-Id: <3550de19.10422928@news.bedford.net>
"test a string" should trigger the thought "regular expression"
if ( $myvar =~ /[^ ]/ ) {
...
}
On Thu, 07 May 1998 15:21:10 -0400, Frank Blanchard <fb@whitaker.org>
wrote:
>i want to test a string to see if
>it contains any characters other
>than spaces.
>
>i tried ne "" and ne " "
>and some other iterations.
>
------------------------------
Date: 7 May 1998 21:44:37 GMT
From: feder001@csusm.edu.--- (Todd)
Subject: how do i do this with a regular expression?
Message-Id: <6ita05$mt5@newshost.csusm.edu>
I'm trying to turn a date string with "PM" into 24-hour time with a
regular expression:
"4:06:50 PM" ==> "16:06:50"
I use "(\d{1,2})(:\d{2}:\d{2}) PM" to recognize the date and put
the hour I want to add 12 to in $1, but how do I actually perform
addition on $1 in a s# # # statement? Thanks in advance for any
help...
Todd | feder001@csusm.edu
------------------------------
Date: Fri, 08 May 1998 01:32:58 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Todd <feder001@csusm.edu.--->
Subject: Re: how do i do this with a regular expression?
Message-Id: <Pine.GSO.3.96.980507183124.25820J-100000@user2.teleport.com>
On 7 May 1998, Todd wrote:
> I'm trying to turn a date string with "PM" into 24-hour time with a
> regular expression:
That may be your problem; perhaps you should be using a module.
> I use "(\d{1,2})(:\d{2}:\d{2}) PM" to recognize the date and put
> the hour I want to add 12 to in $1, but how do I actually perform
> addition on $1 in a s# # # statement?
Probably you want the /e option. See perlop. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 8 May 1998 01:26:25 GMT
From: coleman@library.ucsf.edu (Gregory Coleman)
Subject: how do i keep range operator in list 'mode'??
Message-Id: <6itn01$1dbs@itssrv1.ucsf.edu>
greetings:
I haven't seen this one before, and i did follow up in Camel land beforehand, but to no avail. Here's the scenario:
I'm parsing my doc just fine, looking for a string that i want to convert to a range, eg.
ID #: 1234/39 would be 'ranged' for 1234, 1235, 1236 ... 1239
Well, all is swell throughout, ...until the numbers get big and the range operator suddenly switches its behavior and tries to evaluate the operand by comparing it to the file handle. Specifically, it chokes on a big number:
ID #: 2500040056/0057
However, i am not sure where exactly the range operator changes. My initial test showed that it's somewhere between 2147000000 and 2148000000
I would understand (and think it cool) if perl didn't want to process a huge range, but in my case, there are only perhaps 3-15 numbers in that range.
What would be helpful is a workaround or override that might make this possible. Am i overlooking something obvious here?
much thanks
--
-gleeco
Gregory Coleman
The Library & Center for Knowledge Management
University of California, San Francisco
------------------------------
Date: Fri, 08 May 1998 01:09:36 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Jamie Hoglund <jhoglund@mirage.skypoint.net>
Subject: Re: How to clear browser Cache with perl
Message-Id: <Pine.GSO.3.96.980507180808.25820F-100000@user2.teleport.com>
On 7 May 1998, Jamie Hoglund wrote:
> $CacheDir="browser_cache";
> opendir(CACHE,$CacheDir);
> @FILES = readdir(CACHE);
> closedir(CACHE);
> unlink(@FILES);
Uh oh. I hope that your current directory was the browser_cache directory,
or you may have deleted other files whose names just happen to be the same
as the ones in the cache.
Also, checking for errors would have been a good idea. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 07 May 1998 21:27:51 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: How to clear browser Cache with perl
Message-Id: <lt1zu5mu08.fsf@asfast.com>
Tom Phoenix <rootbeer@teleport.com> writes:
> On 7 May 1998, Jamie Hoglund wrote:
>
> > $CacheDir="browser_cache";
> > opendir(CACHE,$CacheDir);
> > @FILES = readdir(CACHE);
> > closedir(CACHE);
> > unlink(@FILES);
>
> Uh oh. I hope that your current directory was the browser_cache directory,
> or you may have deleted other files whose names just happen to be the same
> as the ones in the cache.
I doubt that the `opendir' would work at all if the current directory
is `browser_cache'. An unlikely scenario where this could occur is
where `browser_cache' also contains a subdirectory named
`browser_cache' or a symbolic link by that name pointing to the parent
`browser_cache'. Other than in these cases, `@FILES' would be an
empty list and hence nothing would be deleted.
I think that you probably meant to say "I hope that your current
directory was the parent of the browser_cache directory".
> Also, checking for errors would have been a good idea. Hope this helps!
--
Lloyd Zusman ljz@asfast.com
perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
$t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
$x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'
------------------------------
Date: Thu, 07 May 1998 23:56:23 GMT
From: brz@hotmail.com
Subject: how to retrieve a string from an html page
Message-Id: <6ithn8$b27$1@nnrp1.dejanews.com>
I am using LWP module to get an html page... in which there're
several instances of cgi-bin/abcdef-234/Search embedded. I'd
like to retrieve abcdef-234 and store it in a variable..
Can someone teach me how to do that.. thanks!
Enclosed is my code using LWP.
use LWP::UserAgent;
$ua = new LWP::UserAgent;
#$ua->env_proxy;
my $req = new HTTP::Request 'GET' =>
'http://www.foo.com/cgi-bin/createform.cgi';
my $res = $ua->request($req);
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 08 May 1998 01:30:23 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: brz@hotmail.com
Subject: Re: how to retrieve a string from an html page
Message-Id: <Pine.GSO.3.96.980507182746.25820I-100000@user2.teleport.com>
On Thu, 7 May 1998 brz@hotmail.com wrote:
> I am using LWP module to get an html page... in which there're
> several instances of cgi-bin/abcdef-234/Search embedded. I'd
> like to retrieve abcdef-234 and store it in a variable..
>
> Can someone teach me how to do that.. thanks!
I'd probably use a pattern match, perhaps something like this.
($something) = m#cgi-bin/(.*?)/Search#;
If $something is undefined after that statement, then the pattern didn't
match. For more information about this, see perlop and perlre. Hope this
helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 08 May 1998 01:00:55 GMT
From: bidyut@yahoo.com
Subject: MEmeory problem IN CGI
Message-Id: <6itlga$g42$1@nnrp1.dejanews.com>
Hi There,
I have a CGi program written in Perl which does nothing but downloads file
from server to browser. Now the cgi works fine about 70% of time. If there are
more users downloading files, the CGI shows the error that this CGi misbehaved
and it returnes the following headers.
Now, if i shout down and restart the web server, again the CGI works fine.
This means that there is someway of memory problem in the CGI. How can i have
a solution to it??
Any idea??
Thanks
bidyut
Source code for downloading the file
-----------------------------------
open (MYFILE, "$docname");
binmode(MYFILE);
open(STDOUT);
binmode(STDOUT);
while ( read(MYFILE,$buffer,1024)) {
print $buffer;
}
close(MYFILE);
Close(STDOUT);
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 08 May 1998 01:42:51 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: bidyut@yahoo.com
Subject: Re: MEmeory problem IN CGI
Message-Id: <Pine.GSO.3.96.980507183525.25820L-100000@user2.teleport.com>
On Fri, 8 May 1998 bidyut@yahoo.com wrote:
> I have a CGi program written in Perl which does nothing but downloads
> file from server to browser. Now the cgi works fine about 70% of time.
> If there are more users downloading files, the CGI shows the error that
> this CGi misbehaved and it returnes the following headers.
>
> Now, if i shout down and restart the web server, again the CGI works
> fine. This means that there is someway of memory problem in the CGI.
I don't think that that necessarily follows. Unless, of course, you call
it a memory problem because the program is stored in computer memory! :-)
> open (MYFILE, "$docname");
Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
> open(STDOUT);
What do you think this is doing, and what is it actually doing? It's rare
to see open with one argument used correctly, in my experience.
> binmode(STDOUT);
> while ( read(MYFILE,$buffer,1024)) {
> print $buffer;
> }
>
> close(MYFILE);
> Close(STDOUT);
Hmmm... There's something funny here. :-)
If you still have this problem once you fix those bugs, let me know. Hope
this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 07 May 1998 19:52:40 -0600
From: "Randall S. Willcox" <rswillco@acs.ucalgary.ca>
Subject: Netscape/Perl trouble
Message-Id: <6itnnd$eb2@ds2.acs.ucalgary.ca>
Hi all,
I'm working with a cgi script written in Perl that embeds HTML files
into templates through the use of forms and custom tags. If I include
<script></script> tags in either the HTML files or templates the
documents hang when downloading in Netscape 4.x. It seems this happens
only in Netscape 4.x. The http server is AIX but I'm pretty sure the
server has nothing to do with the problem, the problem seems specific to
NN 4.x
Has anyone experienced similar problems? Anyone know what's going on?
--
------------------------
Randall S. Willcox
Dept. of English
University of Calgary
rswillco@acs.ucalgary.ca
------------------------------
Date: Fri, 08 May 1998 01:13:09 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Jamie Hoglund <jhoglund@mirage.skypoint.net>
Subject: Re: Padding a string to be a fixed length
Message-Id: <Pine.GSO.3.96.980507181013.25820G-100000@user2.teleport.com>
On 7 May 1998, Jamie Hoglund wrote:
> pack("A $len",$string) doesn't appear to work, but:
And if you turned on warnings, Perl would suggest to you what's wrong.
> $packstring = 'A' . $len;
> $string = pack($packstring,$string);
>
> Seems to work OK.
Yes, because you're doing it correctly this time. Of course, you could
have fixed the other one, too. :-) Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 08 May 1998 01:06:25 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Chris Sherman <sherman@unx.sas.com>
Subject: Re: Passing long command line to shell, best way?
Message-Id: <Pine.GSO.3.96.980507175846.25820E-100000@user2.teleport.com>
On Thu, 7 May 1998, Chris Sherman wrote:
> Suppose I want to pass a 500 character command to the command line.
> What is the best way of doing this in perl?
Store your arguments (including the command name itself) in a list,
probably. Then it's easy to examine them for debugging, as an added bonus.
But then you can use something like system(@list) or $output = `@list`
which is clean and easy to work with.
> Suppose I have 50 separate non-repeative commands to run at the shell
> (/bin/sh), and I want to feed them to the shell at all once, but without
> using a temporary file to hold the commands (that is, write the commands to
> a file and just run /bin/sh on that file):
Maybe you should do those 50 commands all within Perl. :-) But maybe you
want an executable here-document. Look for 'here-doc' in perldata for more
about this. Of course, if command 27 fails, you may never know it... :-)
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 08 May 1998 00:18:14 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: perl scripts dealing with /etc/passwd
Message-Id: <35524D81.42F16FEF@fccjmail.fccj.org>
David A. Lyons wrote:
>
> Somebody please point me to a resource where I can analyze perl scripts
> that do various things to the /etc/passwd file, like add, remove,
> change, view, sort entries, check password, etc. I don't know perl, but
> I'm planning to add a database to a web site where users can enter,
> change & remove their entries and it'll use a username/password so
> others can't affect another's entry. I figure looking at perl scripts
> that work with the /etc/passwd will be a good place to start on the
> learning curve, since my will be implemented similarly.
>
> Dave
Try here -
http://reference.perl.com/query.cgi?security
And then here -
http://webmaster.fccj.org/Webmaster/WebPass.html
Then you will see how easy/hard it is, depending upon how
much study/work you wish to do.
The first reference is where you will find modules/code dealing
with /etc/passwd and /etc/shadow stuff; the next is a shameless
plug. When I was just starting out I ran across a script
which would appear to do what I wanted, but after a few
trail runs it hosed my Sun box pretty good. So after a
little research (enough to be dangerous) I wrote WebPass.cgi
and WebPass.expect. Both together will point you in the
right direction. Plus, there is an Perl/Expect.pm module
which will allow you to do the WebPAss.cgi without TCL/Expect.
HTH,
-Sneex- :-)
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster
------------------------------
Date: Fri, 08 May 1998 00:57:52 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: "Allan M. Due" <alpaca@iname.com>
Subject: Re: perl scripts dealing with /etc/passwd
Message-Id: <Pine.GSO.3.96.980507172928.25820D-100000@user2.teleport.com>
On 7 May 1998, Allan M. Due wrote:
> >> # Get the input
> >> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> >
> >Yes, this is the same broken code we've seen dozens of times.
>
> Sorry to be slow, but what is wrong with the above code?
Well, besides that line (which assumes that the environment variable is
correctly set, and which doesn't check for read errors) the code goes on
to decode the input in ways which don't agree with the CGI specification.
Another way to say that is that valid input from a web-based form may not
be handled correctly, and invalid input isn't handled correctly either.
This is why I encourage people to use a module rather than cutting-
and-pasting in most cases. If it turns out that the module has a mistake
in it, you need fix only the one file, typically, to make everything work
again. But if the mistakes are spread among all of the files you've pasted
that buggy code into, it can be a lot of work to track down. In addition,
a good module for CGI scripting will let you debug your code from the
command line, so that you don't have to install the script on a server for
most debugging purposes.
So, with proper use of a good module, your code is easier to write, easier
to read, easier to debug, and easier to maintain. Pretty good, huh?
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 08 May 1998 00:27:16 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Alan McCoy <a.r.mccoy@larc.nasa.gov>
Subject: Re: Perl, SSI, and Cookies
Message-Id: <Pine.GSO.3.96.980507172531.25820B-100000@user2.teleport.com>
On Thu, 7 May 1998, Alan McCoy wrote:
> The script runs fine when called by itself in a browser, however, when
> it is run as a virtual include on another page, the script doesn't
> extract the cookie data.
Well, it's not a Perl problem, since your code is okay. Probably it's
running in a different environment than you expect, or something like
that. Folks in a newsgroup about CGI scripting and related issues should
be able to give you answers more complete and accurae than we can here.
Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 8 May 1998 00:35:02 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: pop/push,shift/unshift ?????
Message-Id: <6itjvm$nor$1@comdyn.comdyn.com.au>
In article <98050721192100.05043@fpc>,
fantha <fantha@berlin1.netsurf.de> writes:
> Hi there!
>
> It's me again. First I'd like to thank everyone who
> helped me with my simple problem ("chomp").
>
> Now I've got a second question. The author of my
> perl book writes about the functions pop/push,shift/unshift.
> But he doesn't explain these functions. Really bad.
> He shows an example, but I dont know what he means by that.
> Here they are:
>
>>> @ary = ("aa", "bb", "cc");
>>> push (@ary, "hi"); # @ary = (..)
>>> unshift (@ary, "ho"); # @ary = (..)
>>> $popped = pop(@ary); # @ary = (..), $popped = ..
>>> $shifted = shift @ary; # @ary = (..), $shifted = ..
>
> What the hell does this mean ?
If this is all that is found on these functions in your book, then
maybe you should get another book :)
In addition to your book, you should probably also refer to the
documentation that comes with perl. Once you really start programming,
you'll find that that is the first place you look, because it's more
up to date than most books, and because it's available from your
command line.
e.g.
# perldoc perl
# perldoc perldoc
# perldoc perlfaq
And for the functions you were looking for:
# perldoc -f push
# perldoc -f pop
# perldoc -f unshift
# perldoc -f shift
push and pop and add an element to the end of a list or take it from
the end.
unshift and shift do the same to the start of the array.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd. | enough features yet.
NSW, Australia |
------------------------------
Date: Fri, 8 May 1998 01:12:37 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: pop/push,shift/unshift ?????
Message-Id: <EsM611.HG8@presby.edu>
fantha <fantha@berlin1.netsurf.de> wrote:
>
>>> @ary = ("aa", "bb", "cc");
>>> push (@ary, "hi"); # @ary = (..)
>>> unshift (@ary, "ho"); # @ary = (..)
>>> $popped = pop(@ary); # @ary = (..), $popped = ..
>>> $shifted = shift @ary; # @ary = (..), $shifted = ..
>
>What the hell does this mean ?
1. Put these statements into a short test program.
2. Add "print" statements that print out the contents of @ary after each
statement, and the values of $popped and $shifted at the end.
3. Run the program and study the output. It should be rather obvious
what is happening, and faster than waiting for responses from the Net.
:-)
--
Jon Bell <jtbell@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
------------------------------
Date: 8 May 1998 00:35:11 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Question: Is Perl an acronym?
Message-Id: <6itjvv$qvf$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
Larry chose the name Perl, or at least the pronuciation, for its connotations.
All acronyms are back-derived to fit the sound that so appealed to him.
--tom
--
I hate programs that chdir --Boyd Roberts
------------------------------
Date: 8 May 1998 00:47:25 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Question: Is Perl an acronym?
Message-Id: <6itkmu$s8g$1@marina.cinenet.net>
evangelo@dnai.com wrote:
: OK, so everybody's got serious programming issues they're trying to deal
: with, but *I've* got a frivolous and nit-picking question which is extremely
: .misc, so listen to me!
:
: I recently corrected a friend on his misspelling of PERL. "Use perl or Perl
: instead, my friend," I said politely. "Perl is not an acronym."
[snip]
: So, it comes down to this: Is 'perl' an acronym? Were the name "perl" and
: the term "Practical Extraction and Reporting Language" developed together, or
: did one come before the other?
It's not the first case of an acronym becoming a word; "vitriol" predates
it by several centuries, for one example. See also "radar." So,
regardless of whether it began life as an acronym, [Pp]erl is a word
*now*. That's my view, anyway.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 07 May 1998 21:13:27 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Question: Is Perl an acronym?
Message-Id: <lt4sz1muo8.fsf@asfast.com>
cberry@cinenet.net (Craig Berry) writes:
> evangelo@dnai.com wrote:
>
> [ ... ]
>
> : So, it comes down to this: Is 'perl' an acronym? Were the name "perl" and
> : the term "Practical Extraction and Reporting Language" developed together,
> : or did one come before the other?
>
> It's not the first case of an acronym becoming a word; "vitriol" predates
> it by several centuries, for one example. See also "radar." So,
> regardless of whether it began life as an acronym, [Pp]erl is a word
> *now*. That's my view, anyway.
Well, as was mentioned by Tom Christiansen in a recent post, Larry
Wall created the name "Perl" and then back-fitted some the various
acronyms that have been attributed to it. Therefore, "Perl" *always*
was a word.
And to the best of my knowledge, the "Practical Extraction and
Reporting Language" acronym was *not* the first one back-fitted by
Larry Wall. As early as 1988, I recall seeing his mention of another,
possibly more appropriate acronym in the Perl man pages.
--
Lloyd Zusman ljz@asfast.com
perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
$t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
$x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'
------------------------------
Date: Fri, 08 May 1998 01:25:31 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: evangelo@dnai.com
Subject: Re: Question: Is Perl an acronym?
Message-Id: <Pine.GSO.3.96.980507181805.25820H-100000@user2.teleport.com>
On Thu, 7 May 1998 evangelo@dnai.com wrote:
> I recently corrected a friend on his misspelling of PERL. "Use perl or
> Perl instead, my friend," I said politely. "Perl is not an acronym."
>
> "Wrong!" said another, rather argumentative friend. "It stands for
> Practical Extraction and Reporting Language."
Tell your friend that he or she should spell such words as LASER, ZIP
code, and SCUBA in all caps, by that logic. In general, once a word has
become more of an abbreviation than an acronym, it loses its
capitalization. But there are exceptions, of course. Perl isn't one of
them, as the FAQ explains. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 8 May 1998 00:48:53 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Setting Environment Variables
Message-Id: <6itkpl$nor$2@comdyn.comdyn.com.au>
In article <35523E70.6DEC@itron.com>,
Laura Morgan <laura.morgan@itron.com> writes:
> Is there a way to set environment variables from within a Perl script so
> that once I've exited Perl, I can do a "set" and see the environment
> variable that I've set? I can't seem to figure out how to do this. I
> need something that will work on NT and UNIX (Korn Shell).
# perldoc perlfaq
# perldoc perlfaq8
I {changed directory, modified my environment} in a perl
script. How come the change disappeared when I exited the
script? How do I get my changes to be visible?
There are comments about Unix and VMS there. I have seen this question
asked about NT on this group, so you might be able to find it on
dejanews. It was something with fiddling around in the registry.
There won't be a single way to do it for both. There might not be a
way at all for the Unix and the shell you're using.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Very funny Scotty, now beam down my
Commercial Dynamics Pty. Ltd. | clothes.
NSW, Australia |
------------------------------
Date: Fri, 08 May 1998 01:37:16 GMT
From: heiby_u@falkor.chi.il.us (Ron Heiby)
Subject: Re: Win95 Perl scripts DONT WORK on UNIX
Message-Id: <355260a0.7595927@149.174.211.108>
"edepot" <phlin@ix.netcom.com> wrote:
>The only way to fix it is if you have a utility
>to STRIP the "^M" characters on the scripts from unix
>side after you have ftp'ed them from your
>win95 computer.
Umm. This may sound like a totally wacky idea, but did you ever think of
using TEXT mode on your ftp transfers? I kinda think this is what it's there
for.
------------------------------
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 2536
**************************************