[11932] in Perl-Users-Digest
Perl-Users Digest, Issue: 5532 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 1 00:37:20 1999
Date: Fri, 30 Apr 99 21:00:21 -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 Fri, 30 Apr 1999 Volume: 8 Number: 5532
Today's topics:
Re: "learning perl" does not seem to be written well (Bruce R Miller)
Re: $ENV...Explained <selectthree@gsig-net.qc.ca>
Account Registration to email <mmelton@together.net>
Re: Can perl download html files? <cassell@mail.cor.epa.gov>
Re: Can perl download html files? <dimitrio@sympatico.ca>
Clearing Screen <kenrose@home.com>
Re: Clearing Screen <tchrist@mox.perl.com>
Re: Clearing Screen <kenrose@home.com>
Re: copy file <mhc@Eng.Sun.COM>
Re: create directory with perl script? <design@raincloud-studios.com>
Re: create directory with perl script? <cassell@mail.cor.epa.gov>
Does mod_perl work with ActiveState Perl on NT? <s_shah@ix.netcom.com>
Re: Instance Data / Instance Variables <uri@sysarch.com>
Re: Is this the best way to get a substring? (Tad McClellan)
Re: Is this the best way to get a substring? (Ronald J Kimball)
MLM perl script <cpl11@netcom.ca>
Re: MLM perl script <uri@sysarch.com>
Re: newbie q: compiling perl (Bob Trieger)
Re: Newsfeed and Local Weather <uri@sysarch.com>
Re: Perl on a 386 with 2 MB RAM??? <bowman@montana.com>
Re: RegEx for matching Mbx "From " delimeter (Ronald J Kimball)
rename files <h0p2468@acs.tamu.edu>
Re: searching perl documentation lvirden@cas.org
Re: simple print location and content-type? <huymle@gis.net>
Stumped on Regex routine <jakob@pris.bc.ca>
Re: Stumped on Regex routine <cassell@mail.cor.epa.gov>
Re: Using a reference to an array (Andrew Allen)
Re: using perl to manage passwords? <dimitrio@sympatico.ca>
Re: Using perl to set permissions when chown is blocked <design@raincloud-studios.com>
Re: Using perl to set permissions when chown is blocked <design@raincloud-studios.com>
Re: Using perl to set permissions when chown is blocked (Sam Holden)
Re: Using perl to set permissions when chown is blocked <uri@sysarch.com>
Re: what's wrong with $x = $y or "" (Ronald J Kimball)
Where is LWP: POP3Client.pm? <huymle@gis.net>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Apr 1999 22:52:07 GMT
From: miller@altaira.cam.nist.gov (Bruce R Miller)
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <7gdc6n$qmh$1@news.nist.gov>
In article <7g2ee1$uqp$1@nnrp1.dejanews.com>,
ralawrence@my-dejanews.com writes:
>I've now made a total tit out of myself infront of 16 million odd people.
Who ya callin' odd, newbie ?!?
--
--
bruce.miller@nist.gov
http://math.nist.gov/~BMiller/
------------------------------
Date: Fri, 30 Apr 1999 22:25:35 -0400
From: Pierre-Luc <selectthree@gsig-net.qc.ca>
Subject: Re: $ENV...Explained
Message-Id: <372A661C.F06B19CC@gsig-net.qc.ca>
Here are all I know :
AUTH_TYPE
DOCUMENT_ROOT
GATEWAY_INTERFACE
HTTP_ACCEPT
HTTP_ACCEPT_CHARSET
HTTP_ACCEPT_ENCODING
HTTP_CONNECTION
HTTP_HOST
HTTP_REFERER
HTTP_USER_AGENT
PATH
QUERY_STRING
REMOTE_ADDR
REMOTE_HOST
REMOTE_PORT
REMOTE_USER
REQUEST_METHOD
REQUEST_URI
SCRIPT_FILENAME
SCRIPT_NAME
SCRIPT_URI
SCRIPT_URL
SERVER_ADMIN
SERVER_NAME
SERVER_PORT
SERVER_PROTOCOL
SERVER_SOFTWARE
Note that all these are coming from Links, )1999 Gossamer-Threads inc.
Pierre-Luc Soucy
Jonathan Stowe wrote:
> On Sun, 25 Apr 1999 00:55:15 -0500 HowToFoldSoup wrote:
> > I believe the people who answered the question weren't understanding the
> > question.
> >
>
> Thats a bit difficult to know because your post has no references: header
> so I cant tell which question you are referring to.
>
> > What the questioner, as I understand it, was trying to ask was if there is a
> > list of the $ENV{'VAR_TYPE'} type of variables that a browser automatically
> > passes to the perl script.
> >
>
> I dont know why you always have someone who has to turn every question
> into one about the CGI. Of course it is well known that Perl is *only*
> ever used for CGI stuff isnt it ...
>
> Anyhow you're wrong: the browser passes nothing to the CGI program - and
> if the mythical original poster had put the question that way he would
> have been told so as well - the browser sends some stuff to the server and
> the server passes some stuff to the CGI program - possibly in environment
> variables depending on the circumstances. I think that you should read
> the CGI specification at :
>
> <http://hoohoo,ncsa.uiuc.edu>
>
> > I know of the Following:
> >
> <SNIP>
> >
> > I actually came here looking for a similar list, preferably complete, is
> > anyone can provide one.
> >
>
> The necessary ones are stated in the CGI specification.
>
> You can find which ones are made available to your program by your server
> by running a short program that prints the variables:
>
> #!/usr/bin/perl
>
> print "Content-type: text/plain\n\n";
> while (($key, $val) = each %ENV) {
> print "$key = $val\n";
> }
>
> And just to demonstrate this is nothing to do with Perl in particular:
>
> #!/bin/sh
>
> echo "Content-type: text/plain"
> echo
> set
>
> Anyhow its nothing to do with Perl - this and similar questions should be
> asked in comp.infosystems.www.authoring.cgi
>
> /J\
> --
> Jonathan Stowe <jns@gellyfish.com>
> Some of your questions answered:
> <URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
> Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Fri, 30 Apr 1999 23:19:13 -0400
From: "Matt Melton" <mmelton@together.net>
Subject: Account Registration to email
Message-Id: <372a71fb@news.together.net>
Hi there everyone,
I'm looking for some sort of script that will allow a "new user" to register
an account by entering their email address and a user name, and when they
submit the form, an email is automatically sent to the address they entered
with a generated password which in turn allows them to access the site...
Obviously these scripts exist as we've all seen them, but now has come the
time that I need to see it from the other side. If anyone can point me in
the right direction, I'd appreciate.
Regards,
Matt
------------------------------
Date: Fri, 30 Apr 1999 17:03:38 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Can perl download html files?
Message-Id: <372A44DA.3711FDE0@mail.cor.epa.gov>
Ashim wrote:
>
> Hi
> Is there any way to write a perl script which can take a URL as input
> and download it into a file? Just something that can surpass Netscape.
I'm guessing from your multiple posts that you're using Nyetscape
right now, in fact. :-)
Yes, there is. Look at the LWP::Simple module, which will let
you get() a webpage in one easy step. Then it's up to you
what to do with it. Save it to a file. Print it. Edit it first.
Mix it; match it; trade it with friends!
Check and you might find that this module is *already* on the system
you're using.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: Sat, 01 May 1999 02:19:35 GMT
From: Dimitri Ostapenko <dimitrio@sympatico.ca>
Subject: Re: Can perl download html files?
Message-Id: <372A2CCC.E393724D@sympatico.ca>
Ashim wrote:
> Hi
> Is there any way to write a perl script which can take a URL as input
> and download it into a file? Just something that can surpass Netscape.
>
> Thanks
> Ashim
You can find simple example of LWP::Simple at www.perlnow.com - getdtv.cgi
You can use code in INC.cgi from the same page to check if LWP is installed
on your system.
Dimitri Ostapenko
------------------------------
Date: Fri, 30 Apr 1999 23:55:51 GMT
From: Kenneth Rose <kenrose@home.com>
Subject: Clearing Screen
Message-Id: <372A425C.C05E567D@home.com>
Hi all,
Quick question...have a contest tomorrow and wondering if this can be
done: clearing the screen. That is:
print "This will be gone soon";
<STDIN>;
cls;
print "Now it's gone";
Anything like that cls command available? cls itself does nothing.
Thanks!
/<en
------------------------------
Date: 30 Apr 1999 18:00:07 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Clearing Screen
Message-Id: <372a4407@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Kenneth Rose <kenrose@home.com> writes:
:Hi all,
:
:Quick question...have a contest tomorrow and wondering if this can be
:done: clearing the screen. That is:
:
:print "This will be gone soon";
:<STDIN>;
:cls;
:print "Now it's gone";
:
:Anything like that cls command available? cls itself does nothing.
This isn't a shell. And you won't win your contest.
A customary way to clear the screen is
system("clear");
But using Term::Cap might be faster in the long run.
--tom
--
I do not feel obliged to believe that the same God who has endowed us
with sense, reason, and intellect has intended us to forgo their use.
--Galileo Galilei
------------------------------
Date: Sat, 01 May 1999 00:13:33 GMT
From: Kenneth Rose <kenrose@home.com>
Subject: Re: Clearing Screen
Message-Id: <372A4682.2503641C@home.com>
[courtesy cc of this posting sent to cited author via email]
Thank you....actually, normally I'd use Pascal, but Perl would make this
problem much easier...it just called for a screen clear.
BTW, I don't only intend to win, I intend to annihalate the competition!
/<en
Tom Christiansen wrote:
>
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc,
> Kenneth Rose <kenrose@home.com> writes:
> :Hi all,
> :
> :Quick question...have a contest tomorrow and wondering if this can be
> :done: clearing the screen. That is:
> :
> :print "This will be gone soon";
> :<STDIN>;
> :cls;
> :print "Now it's gone";
> :
> :Anything like that cls command available? cls itself does nothing.
>
> This isn't a shell. And you won't win your contest.
>
> A customary way to clear the screen is
>
> system("clear");
>
> But using Term::Cap might be faster in the long run.
>
> --tom
> --
> I do not feel obliged to believe that the same God who has endowed us
> with sense, reason, and intellect has intended us to forgo their use.
> --Galileo Galilei
------------------------------
Date: 30 Apr 1999 18:27:56 -0700
From: Mike Coffin <mhc@Eng.Sun.COM>
Subject: Re: copy file
Message-Id: <8p61zh1fujn.fsf@Eng.Sun.COM>
cpl11 <cpl11@netcom.ca> writes:
> Dear Friends
> I also look for a command which enable perl script to copyone file to
> another directory
> Thank you for help me out
> Andrea
use File::Copy;
unless (copy("/etc/hosts", "/tmp")) {
die "copy failed: $!\n";
}
-mike
------------------------------
Date: Fri, 30 Apr 1999 23:20:06 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: create directory with perl script?
Message-Id: <GUqW2.80$iu1.153@news.rdc1.tn.home.com>
>:mkdir("/mydir/", 0550);
>Not very useful. Better use 0777 unless you are doing mail or
>some such.
I had 0775 at first, but wondered if it was a bad idea to start
someone off leaving directories open like that. I was always
beaten with a stick if I didn't start low and work my way up
until it 'just clicked' for security sake. Wasn't sure if they
were doing something on a live site or local machine, or what.
Just tryin to help... and off to a bad start. :)
CT
------------------------------
Date: Fri, 30 Apr 1999 16:46:10 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: create directory with perl script?
Message-Id: <372A40C2.AAC18845@mail.cor.epa.gov>
Charles R. Thompson wrote:
>
> >:mkdir("/mydir/", 0550);
>
> >Not very useful. Better use 0777 unless you are doing mail or
> >some such.
>
> I had 0775 at first, but wondered if it was a bad idea to start
> someone off leaving directories open like that. I was always
> beaten with a stick if I didn't start low and work my way up
> until it 'just clicked' for security sake. Wasn't sure if they
> were doing something on a live site or local machine, or what.
>
> Just tryin to help... and off to a bad start. :)
Don't worry about it. If you haven't been taken to task in this
newsgroup by tchrist, you're... Well I was going to say `nobody',
but you might be Larry Wall. :-)
We all try to get the answers right, since making a doofus in front
of your peers and umpteen million others isn't too much fun.
But that means that we also try to correct other people's mistakes
too. Just don't take it personally, and be aware that sooner or
later you'll make another braino. In my case, sooner. :-)
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: Fri, 30 Apr 1999 19:58:05 -0500
From: "Snehanshu Shah" <s_shah@ix.netcom.com>
Subject: Does mod_perl work with ActiveState Perl on NT?
Message-Id: <7gdjmm$hg3@dfw-ixnews5.ix.netcom.com>
I am currently running Apache on NT and using plain old CGI and
would like to try to speed up my web application using mod_perl.
Can I use mod_perl with ActiveState Perl on NT?
If not, where can I get a pre-compiled Perl for Windows NT that mod_perl
would work with.
Thanks,
Shah
--
-----------------------------------------
Snehanshu Shah
HiveTech, Inc.
ph. (512) 791 4372
fax. (630) 839-7513
shah@hivetech.com
www.hivetech.com
------------------------------------------
------------------------------
Date: 30 Apr 1999 23:24:33 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Instance Data / Instance Variables
Message-Id: <x7vhed5v66.fsf@home.sysarch.com>
>>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:
TC> I'd rather err on the side of disgression. Never trust a man who
^^^^^^^^^^^
tom,
normally i would never nitpick spelling on usenet and i'd never dispute
your verbal skills, but what is that word? it looks like you mean to say
discretion. the closest word in the online dictionary is digression
which doesn't fit at all.
uri (waiting for the candy to hit me)
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Fri, 30 Apr 1999 14:19:34 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Is this the best way to get a substring?
Message-Id: <m7scg7.9o.ln@magna.metronet.com>
Jerome O'Neil (jeromeo@atrieva.com) wrote:
: Randal L. Schwartz wrote:
: >
: > But that's actually why I pointed it out. Checking $1 without having
: > checked whether the match succeeded leads to general errors akin to
: > opening a file without checking the return of the open.
: I don't want you to misunderstand my position. I *don't* disagree with
: you. However, within the context of this example, it adds complexity
: that doesn't need to be there.
Yes, but the newbie that you are writing to does not know that.
Anybody with their Perl wits about them would say "Huh?" to
doing a pattern match against a string that is hard-coded
in the first place.
But the new folks are just going to cut and paste that pattern
match into their real (and useful) code that attempts matches
against unknown input, where the hard-to-find bug will
manifest itself.
: There are many, many caveats that we can add to any particular code
: snippet posted any given day. The drawback is that we end up writing
: full blown applications to demonstrate simple concepts, and that often
: adds confusion.
Depending on pattern matching against a hard-coded string
is rather silly, since it is not useful, so you pretty much
_have_ to expect that they are going to end up using it on
strings that are not hard-coded.
: > And having an answerer provide bad bits of code is something I'm
: > always on the watch for. We don't need to hand bad bits to newcomers.
: If I had written:
: #!/bin/perl -w
: use strict;
: while(<>){
: my $string = $_;
: next unless $string =~ /^(\d+)\D+/;
: my $digits = $1;
: # WooHoo!!
: }
: would you feel this is a clearer example of binding and backtracking? I
: don't (and it's a whole lot more to type!)
I expect just including a conditional test of the pattern match
would have been enough for Randal to move on to the next post,
since the poster wouldn't be back the next day when after they
incorporated it into code that really does something.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 30 Apr 1999 23:24:37 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Is this the best way to get a substring?
Message-Id: <1dr3j8l.1addv2z6ps4w6N@p170.block1.tc4.state.ma.tiac.com>
Jerome O'Neil <jeromeo@atrieva.com> wrote:
> Ronald J Kimball wrote:
> >
> > We already have to advise new programmers who are creating their own
> > mistakes in their Perl code. We don't need experienced posters giving
> > them more mistakes by providing poor examples.
>
> I'm afraid that Randall, Tad, yourself, and I are all going to have to
> agree to disagree on this particular topic. We shouldn't be answering
> questions that weren't asked, and the example was written to show
> specific uses. I'll stand by that every time.
Would the following invented exchange match your philosophy?
New programmer: How do I open a file?
Jerome O'Neil: open(FILE, "filename");
New programmer: That didn't work. Why not?
Jerome O'Neil: You have to check the return value of open() to find out
why it failed.
New programmer: How do I do that?
Jerome O'Neil: open(FILE, "filename") or die "open failed: $!\n";
If so, I don't see how you can stand by it. Instead of providing a
complete answer from the beginning, I can imagine you taking three posts
just to lead the new programmer to the solution.
[repeated here:]
> We shouldn't be answering questions that weren't asked
There is a fatal flaw with that guideline, which is that new programmers
often _don't know the right question to ask_. Knowing the right
question to ask may require almost as much experience as knowing how to
find the answer. If someone asks how to have a variable be named in
another variable should we just explain soft references and not mention
the safer and less error-prone hashes? We can't possibly limit our
answers to the exact questions asked and hope to be helpful to those
seeking our help.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Fri, 30 Apr 1999 22:51:30 -0400
From: cpl11 <cpl11@netcom.ca>
Subject: MLM perl script
Message-Id: <372A6C31.5790B9F9@netcom.ca>
Where I can find a good MLM program perl scripts
thanks for information
------------------------------
Date: 30 Apr 1999 23:43:18 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: MLM perl script
Message-Id: <x7ogk55uax.fsf@home.sysarch.com>
>>>>> "c" == cpl11 <cpl11@netcom.ca> writes:
c> Where I can find a good MLM program perl scripts
c> thanks for information
i have one you can buy by sending me $1000 and putting your name into
/dev/null. it is guaranteed to work as i will get your money and your
name will be on the top of the list in /dev/null. so send your money
today, don't delay, wire it, snail mail it, but send it now!!
this MLM script is perfect, it automatically sends out no mail except it
forwards your bank account numbers and atm codes to me. so you don't
have to go to a web site or download any code, just send your money to
me. it so simple even you can do it! just go to your checkbook and fill
in the blanks, Pay to the order of Uri Guttman, $1000.00. then find my
address (i am in all the best books) and mail me the check. when i cash
it i won't send you anything back so we have not made an illegal
transactions. that is the beauty of my MLM script, you send me money and
i send you nothing. if you want to send more than $1000 you can do that
too. just empty out your account and you are guaranteed to be poor! what
more could this program do for you!!!!!
so please do this now for yours and my sakes. we both know it will
work. i have had much success with this script. i am a well know perl
hacker and many people pay me for my code so you know you are getting
top quality code that won't crash your system, overload you mailer, or
even be detected or traced back to your isp. why is this true? because
the program does nothing but tell you to send me $1000!!!!! even a
newbie can use (but not write) such a great script. i beg of you don't
blow this opportunity to jump on the bandwagon of the best MLM program
you will ever see. this one is it!!!! just send me $1000 and the rest is
up to you!! only you can make this work for all of us, especially me!!!
i am waiting for the check so send it NOW!!!!!!!!!!!!!!!!
your MLM friend,
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Sat, 01 May 1999 03:13:02 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: newbie q: compiling perl
Message-Id: <7gdqq7$re3$1@oak.prod.itd.earthlink.net>
[ courtesy cc sent by mail if address not munged ]
"Dennis" <dennis@rietvink.demon.nl> wrote:
>Its a couple of weeks ago since i started to use perl. (should have done
>that years ago!!)
It's better late than never.
>I cannot figure out how to compile my scripts. Already downloaded
>EGCS-1.1.2, but i am not familier with this kind of compiling ( I'm a
>spoiled VB GUI kid).
>Can anyone please give my a hint.
You don't. Perl is an interpreted language. It is compiled at runtime.
------------------------------
Date: 30 Apr 1999 23:13:59 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Newsfeed and Local Weather
Message-Id: <x7zp3p5vns.fsf@home.sysarch.com>
>>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:
TC> [courtesy cc of this posting mailed to cited author]
TC> In comp.lang.perl.misc, Uri Guttman <uri@sysarch.com> writes:
TC> :nroff!! nroff embedded in the perl source!!! puleaasee!! use pod and
TC> :pod2man
TC> I think not. In fact, I plan to post more and more troff. Everytime I
TC> catch someone posting HTML to this newsgroup, I will post troff.
TC> This is going to be fun. :-)
TC> See below. Note the author. And do have a nice day.
TC> .SH AUTHOR
TC> Larry Wall
forging that name is no excuse for nroff in perl! he should know pod!
when was this written?
TC> .SH "SEE ALSO"
TC> mv(1)
is this going to be in the power tools kit?
:-)
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Fri, 30 Apr 1999 20:38:57 -0600
From: "bowman" <bowman@montana.com>
Subject: Re: Perl on a 386 with 2 MB RAM???
Message-Id: <QPtW2.161$Ny1.1831@newsfeed.slurp.net>
Bart Lateur <bart.lateur@skynet.be> wrote in message
news:372a1c9e.730063@news.skynet.be...
>
> Maybe it WON'T run. Who knows, without testing. Anyway, here's the
> minimum requirements for DJGPP tools, from the DJGPP FAQ:
> Well, it might just work.
The minimum requirements assume you are trying to compile C or C++ code, I
believe. Trying to compile Perl with gcc on a system with 2mb would be shaky
and slow to say the least. Getting just the perl binaries, cwsdpmi, and
possibly bash if you wanted a real shell might ease the pain. I'm probably
missing some dependency or the other, but you really wouldn't need much of
the djgpp distribution just to get the perl5 interpreter up. Now, trying to
do any perl/c stuff with the full meal gcc toolchain would strongly suggest
a new box.
I'd test it, but even my rat 386 DOS/Linux 'how small can I go?' box has 5
meg.
------------------------------
Date: Fri, 30 Apr 1999 23:24:43 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: RegEx for matching Mbx "From " delimeter
Message-Id: <1dr3k6h.58i2zv1nfyzlsN@p170.block1.tc4.state.ma.tiac.com>
Nicholas Brenckle <nicholas.brenckle@yale.edu> wrote:
> SO: The problem is my pattern matching doesnt conform to the RFC (Anyone
> know the right number?) for mbx format and I miss a few here and there.
> Does anyone have a suggested expression for this line?
Don't you just need to match "From " at the beginning of a line?
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Fri, 30 Apr 1999 18:22:14 -0500
From: "Mei" <h0p2468@acs.tamu.edu>
Subject: rename files
Message-Id: <7gddn3$5m5$1@news.tamu.edu>
Hello,
I have written a pl to rename many files, but it didnt work. I put the
example of the file list and the pl here.
Can someone help me with it? Many thanks.
Mei
rename the following files:
T120023b.bin to 1N18SP6.bin
T120024b.bin to 1N18T7.bin
T120025b.bin to 28J21SP6.bin
T120026b.bin to 28J21T7.bin
T120027b.bin to 47E17SP6.bin
T120028b.bin to 47E17T7.bin
T120029b.bin to 25F22T7.bin
T120030b.bin to 14J22T7.bin
T120031b.bin to 14J22SP6.bin
T120032b.bin to 10J7T7.bin
T120033b.bin to 10J7SP6.bin
T120034b.bin to 23K18T7.bin
T120035b.bin to 23K18SP6.bin
T120036b.bin to 6M11T7.bin
T120037b.bin to 6M11SP6.bin
T120038b.bin to 3D9T7.bin
T120039b.bin to 3D9SP6.bin
T120040b.bin to 4A5T7.bin
#!/usr/local/bin/perl -w
init_list();
$dirname = $ARGV[0] || die "Usage: renamefile.pl dirname \n\n";
opendir (DIR, $dirname) || die "Can't opendir $dirname: $!";
while (defined ($filename = readdir DIR)){
next if $filename eq '.' or $filename eq '..';
$filename= "$dirname/$filename";
($listname, $newname)= @ARGV;
while ($filename eq $listname){
rename ($filename, $newname) ||
die "Can't rename $filename: $!";
}
}
closedir(DIR) || die "Can't closedir dir: $!";
sub init_list {
$file = "name.txt";
open (NAMELIST, $file) || die "Can't open $file: $!";
while (defined ($listname = <NAMELIST>)){
chomp ($listname);
$newname = <NAMELIST>;
chomp ($newname);
}
close(NAMELIST) || die "Can't close namelist: $!";
}
------------------------------
Date: 1 May 1999 03:28:03 GMT
From: lvirden@cas.org
Subject: Re: searching perl documentation
Message-Id: <7gdsc3$6qm$1@srv38s4u.cas.org>
According to David Cassell <cassell@mail.cor.epa.gov>:
:Ed Bogart wrote:
:> physio% perldoc Term::Info
:> No documentation found for "Term::Info".
:perldoc Term::Info
:
:That's the way to use it. But if your sysadmin [or you] hasn't
:installed the module, you won't have any docs to be found. Try
I have Term::Info installed on my SPARC Solaris system and I get the
same "No documentation found" error msg myself...
--
<URL: mailto:lvirden@cas.org> Quote: Saving the world before bedtime.
<*> O- <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
------------------------------
Date: Fri, 30 Apr 1999 22:23:07 -0400
From: Huy Le <huymle@gis.net>
Subject: Re: simple print location and content-type?
Message-Id: <372A658B.46FF8D8B@gis.net>
Just print URL of the file you want to invoke for download.
Here is a simple example:
#!/usr/local/bin/perl
print "Location: http://www.yoursite.com/filetodownload.zip\n\n";
1;
Try that.
Jimx wrote:
> how do i print a location command after a content-type?
>
> print "Content-type:text/html\n\n";
> print "some text and html";
> print "Location: $file_name\n\n";
>
> please email if you can thanks
> --
> jimx@metronet.com
> '...........................................................
> ' That which we call sin in others, is experiment for us.
> '
> ' Ralph Waldo Emerson (1803-1882)
------------------------------
Date: Fri, 30 Apr 1999 17:15:15 -0700
From: Jakob Larnforth <jakob@pris.bc.ca>
Subject: Stumped on Regex routine
Message-Id: <372A4793.3F17A0A2@pris.bc.ca>
Hello All
I am completely stumped on a short little code bit.
What I am trying to do is to work backwards on a string and
chop off all words up to and including a specific character.
I am trying the following:
$Url = 'http://www.somedomain.com/frugal/jummy.html';
$Url =~ s/\/.+?$//;
I am trying to get the final output of $Url to eq
http://www.somedomain.com/frugal
However, I always end up with just
http:
It is my understanding that a "?" question mark after the
quantifier will stop this greedy matching behaviour.
Please show me the error's of my ways, my head hurts from
banging it agains't the wall.
Regards
Jakob
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com/ The Largest Usenet Servers in the World!
---------== Over 72,000 Groups, Plus Dedicated Binaries Servers ==--------
------------------------------
Date: Fri, 30 Apr 1999 17:41:03 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Stumped on Regex routine
Message-Id: <372A4D9F.21B18B7E@mail.cor.epa.gov>
Jakob Larnforth wrote:
>
> Hello All
>
> I am completely stumped on a short little code bit.
>
> What I am trying to do is to work backwards on a string and
> chop off all words up to and including a specific character.
>
> I am trying the following:
>
> $Url = 'http://www.somedomain.com/frugal/jummy.html';
> $Url =~ s/\/.+?$//;
>
> I am trying to get the final output of $Url to eq
> http://www.somedomain.com/frugal
>
> However, I always end up with just
> http:
The problem is simple, once you see it (like all good magic
tricks). You may be trying to start from the right, but
Perl is still starting from the left. So, first it finds
a `/'. Not the alst one, but the *first* one. Then it matches
until the first end-of-line. Which is, in your case, the
only end-of-line. So all that's left is `http:'.
If you really want to do this with a regex, you have to make
sure you're not matching another `/' as you go. So
one (of several regex options) looks like:
$Url =~ s|/[^/]+$||;
Note: I changed the delimiter to make it look less like
leaning-toothpick syndrome. Now it matches a slash, followed
by one or more non-slashes, at the end of the string.
But this is probably not the best approach. Look at
the rindex() and substr() functions, and you'll see that
there is a [probably-faster] non-regex solution. Which
Larry Rosler will probably show you.
Larry, you're on. :-)
> It is my understanding that a "?" question mark after the
> quantifier will stop this greedy matching behaviour.
The `?' does change the matching from greedy to, umm,
generous. But that doesn't fix the problem. Because
regexen match *leftmost*first*. So you have to define
the problem in such a way that the earlier slashes are
not viable matches.
> Please show me the error's of my ways, my head hurts from
> banging it agains't the wall.
I hope my comments above were enlightening. But for
real information, you should Read The Fine Manpages that
are provided with your Perl install. The perlre pages
are full of really useful tidbits.
And also: take two aspirin for that headache, and
re-plaster that wall before your landlord sees that dent.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: 30 Apr 1999 23:15:01 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: Using a reference to an array
Message-Id: <7gddhl$gvh$1@fcnews.fc.hp.com>
Eric Arnold (nospam_earnold@requisite.com) wrote:
: The answer is to add brackets: $#{@$xreference}
That works but $#$xreference is simpler. Your version works only
because of some undocumented magic that makes $#{@array} work. The
rule is actually quite simple: wherever you would put the name of a
variable, you can substitute either:
1- $ref, where $ref holds a reference
2- any code enclosed in {} that returns a reference
so if you'd normally write $#bob, but $a=\@bob, then you write
$#$a. Similarly, if $c[7]=\$a, then you could write $#${$c[7]}
Andrew
------------------------------
Date: Sat, 01 May 1999 03:06:15 GMT
From: Dimitri Ostapenko <dimitrio@sympatico.ca>
Subject: Re: using perl to manage passwords?
Message-Id: <372A37BD.84F49979@sympatico.ca>
Dan Baker wrote:
> Jonathan Stowe wrote:
> >
> > Dan Baker <dtbaker@bus-prod.com> wrote:
> > > I need to implement some password protected areas of a website...
> > >
> >
> > This is totally unrelated to Perl. You will need to ask in the
> > appropriate newsgroup for your server.
> ----------
> I don't think it's totally unrelated....
>
> - I'm wondering if there are any things to be aware of if I use perl to
> manage the username and password files.
>
> - I'm wondering if there are perl admin tools already written that
> people know about. I was thinking that perhaps there is a free script
> around that is designed to maintain the username and password files?
>
> Dan
If you are on unix machine you can check out simple login script at
www.perlnow.com -> access.cgi.
It shows how you can communicate with password file.
Dimitri Ostapenko
------------------------------
Date: Fri, 30 Apr 1999 23:11:18 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Using perl to set permissions when chown is blocked
Message-Id: <qMqW2.78$iu1.152@news.rdc1.tn.home.com>
>1) One passes chown() integers, not strings. Did you use
Realized that one. Used the integers and it died.
> strict? -w? Why not?
Cause I was due for a verbal whipping. :)
>2) Are you running as the superuser? That's very dangerous.
no no no! I know at least that half of my brain works. :) It's a
web server where I am only a user. I don't even run my 'fun'
Linux server in that manner! The day after I ran a chown with a
* in the _wrong_directory_ (read gave entire server to one
user), I learned my lesson.
>3) Are you on a system with chown giveaway? That's insecure,
too.
Explain 'chown giveaway' please? I'm unfamiliar with this term.
>From the sound of it, I don't think it's related to what I just
read in one of my Perl books. I cannot even run a chown in
TelNet so I am thinking the administrators don't put chown in
the users' hands. I've read that this is done on 'more secure'
machines for some odd reason or another. Still waiting to hear
back from them on that one.
Here's a -w strict error.
can't set ownership: Operation not permitted at
/web/sites/web90253/cgi-bin/owner.pl line 16.
guess that puts the ball in their court. That's just so stupid.
Really limits some of the things I'd like to do, but I guess
that's the point.
>4) What directory are you in?
Running from a cgi-bin, writing up one level into a
subdirectory. The file gets written to first, so I can 'see'
that works and I am pointing towards the right spot.
>5) Why didn't you print $! in the error message? Are you
> sure you got no errors?
Again.. verbal whipping thing... I was knocking out something
quick and being slack.. ok at least I admit it.
CT
------------------------------
Date: Fri, 30 Apr 1999 23:26:24 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Using perl to set permissions when chown is blocked
Message-Id: <A_qW2.81$iu1.198@news.rdc1.tn.home.com>
>Here's a -w strict error.
>
>can't set ownership: Operation not permitted at
>/web/sites/web90253/cgi-bin/owner.pl line 16.
Make that a $! error... :)
------------------------------
Date: 1 May 1999 03:06:29 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Using perl to set permissions when chown is blocked
Message-Id: <slrn7ikrtl.4l3.sholden@pgrad.cs.usyd.edu.au>
Charles R. Thompson <design@raincloud-studios.com> wrote:
>>3) Are you on a system with chown giveaway? That's insecure,
>too.
>
>Explain 'chown giveaway' please? I'm unfamiliar with this term.
>
>From the sound of it, I don't think it's related to what I just
>read in one of my Perl books. I cannot even run a chown in
>TelNet so I am thinking the administrators don't put chown in
>the users' hands. I've read that this is done on 'more secure'
>machines for some odd reason or another. Still waiting to hear
>back from them on that one.
I think chown giveaway is where a user can chown a file they own so that it
is now owned by another user. This is bad and should not be allowed. The
only system I've used which did that was an SGI machine runnign IRIX.
It's bad for many reasons. It sort of destroys any concept you could have
about enforcing quotas on disk usage. It also opens up some security problems.
Lot's of software these days actually checks that the user owns a file
before using it - a broken chown negates that check.
And there is probably lots more, but IRIX has so many security problems
anyway that chown doesn't make nay difference. ;)
--
Sam
People get annoyed when you try to debug them.
--Larry Wall
------------------------------
Date: 30 Apr 1999 23:30:02 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Using perl to set permissions when chown is blocked
Message-Id: <x7r9p15ux1.fsf@home.sysarch.com>
>>>>> "CRT" == Charles R Thompson <design@raincloud-studios.com> writes:
>> Here's a -w strict error.
>>
>> can't set ownership: Operation not permitted at
>> /web/sites/web90253/cgi-bin/owner.pl line 16.
CRT> Make that a $! error... :)
to clarify tom's reply, chown in most systems is a superuser only
privilege. a few (as he said insecure) allow users to give away
ownership of a file. you might want to look into chgrp if it can do what
you want. by creating the right sets of groups and members you can do
some useful things which are fairly secure.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Fri, 30 Apr 1999 23:24:51 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: what's wrong with $x = $y or ""
Message-Id: <1dr3knj.z5jfkz1tfwymuN@p170.block1.tc4.state.ma.tiac.com>
Philip 'Yes, that's my address' Newton <nospam.newton@gmx.net> wrote:
> Ronald J Kimball wrote:
> >
> > Why couldn't it be called ?? ?
>
> Conflict with the ?...? one-time pattern match operator?
You mean in the same way that <FH> conflicts with $x < $y, and .0123
conflicts with "a" . "b", and 3 * 4 conflicts with *GLOB? But the most
relevant example would be, guess what... $x / $y and /regex/. ;)
Perl disambiguates between these meanings based on whether it is
expecting a TERM or an OPERATOR. Fortunately, it could distinguish
between the proposed ?? defined-or operator and the ?? pattern match
operator in the same way.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Fri, 30 Apr 1999 23:40:21 -0400
From: Huy Le <huymle@gis.net>
Subject: Where is LWP: POP3Client.pm?
Message-Id: <372A77A4.EA952180@gis.net>
I'm try to run the getmail source code I download from perlnow.com but I
get this error message:
Can't locate Mail/POP3Client.pm in @INC (@INC contains:
/usr/local/lib/perl5/i86
pc-solaris/5.00401 /usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/i86pc-sol
aris /usr/local/lib/perl5/site_perl .) at getmail.cgi line 5.
BEGIN failed--compilation aborted at getmail.cgi line 5.
How can I download and install POP3Client.pm so the it fix the above
problem? The @INC above has three directories, can I just install
POP3Client.pm on the /usr/local/lib/perl5 directory? TIA.
Huy
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5532
**************************************