[8256] in Perl-Users-Digest
Perl-Users Digest, Issue: 1873 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 12 11:07:54 1998
Date: Thu, 12 Feb 98 08:00:34 -0800
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, 12 Feb 1998 Volume: 8 Number: 1873
Today's topics:
Re: "Teach Yourself Perl in 21 days" (Was: Re: substitu <tchrist@mox.perl.com>
Re: ? Regular Expressions ? <fp@pmpcs.com>
Re: ? Regular Expressions ? (Clay Irving)
Re: Alphabetical Comparison (Jeffrey R. Drumm)
Re: Alphabetical Comparison <tchrist@mox.perl.com>
Argument parsing <rjk@fprsdev3.fmr.com>
Re: Argument parsing <tchrist@mox.perl.com>
Re: FAQless Forays (was: Code Example Needed) (Bart Lateur)
Re: FAQless Forays (was: Code Example Needed) <tchrist@mox.perl.com>
Re: FAQless Forays (was: Code Example Needed) (Mike Stok)
Re: FAQless Forays (was: Code Example Needed) (Olivier Mary)
Re: FAQless Forays (was: Code Example Needed) (Malcolm Hoar)
Re: FAQless Forays (was: Code Example Needed) <tchrist@mox.perl.com>
Re: Forgery => Killfile (Andy Lester)
Re: Good Perl editors <zkessin@lhr-sys.dhl.com>
Re: How the Hell do I...? (John Moreno)
Re: How the Hell do I...? <tchrist@mox.perl.com>
Re: Is this correct? File Locking <tchrist@mox.perl.com>
Re: Metacharacters and script security - advice please. (Mike Stok)
Re: Perl Wizard Quiz <tchrist@mox.perl.com>
Re: perl-ftp problem <tchrist@mox.perl.com>
Problems with sendmail code <sfoley@magma.ca>
Re: Problems with sendmail code (Nathan V. Patwardhan)
Re: scope of $<digit> <tchrist@mox.perl.com>
Re: SOURCE: tcgrep <tchrist@mox.perl.com>
STDIN input to perl debugger in emacs ilmar@csc.it.moc
Re: test!! please ignore this message i am seeing if it (John Moreno)
testing cgi-perl before submitting to server <pnielsen@netins.net>
Re: Why is Tom Christiansen so rude? (Nathan V. Patwardhan)
Re: Why is Tom Christiansen so rude? <xxTony.Curtis@vcpc.univie.ac.at>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 12 Feb 1998 15:13:09 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: "Teach Yourself Perl in 21 days" (Was: Re: substitute...)
Message-Id: <6bv3i5$asu$5@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Martin Bialasinski <agr30@uni-koeln.de> writes:
:Anyway, the Panther book is better then both books. Never seen a technical
:book that good (although the erratum is quite long already :-( ).
(In English, like Latin, we tend to say "errata are" for a list of them, and
"erratum is" for just one.)
:the first two chapters should be the standard reading for those who wants
:to learn about references.
I agree, at least with the last bit. :-)
Let me also please recomment "Perl: the Programmer's Companion", by
Nigel Chapman. Very small, very nice.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
I'm TRYING to be a back end! - --Andrew Hume
------------------------------
Date: Tue, 10 Feb 1998 19:57:55 -0500
From: "Peter Perchansky" <fp@pmpcs.com>
Subject: Re: ? Regular Expressions ?
Message-Id: <34e318ef.0@news1.ibm.net>
Greetings Tom:
Tom Christiansen wrote in message <6bqpkq$l7c$2@csnews.cs.colorado.edu>...
> % man perlfaq4
> % man perlfaq6
I don't have access to telnet in order to look at manual pages. Can you
point me to a web page?
Thank you.
--
===========================================================
Peter Perchansky, Computer Consultant & Microsoft FrontPage MVP
Dynamic Net, Inc. DBA PMP Computer Solutions
Internet Programming, Web Site Promotion, and more
FrontPage Web Hosting at http://www.pmpcs.com/services/fpwebhosting.htm
FrontPage Support http://www.pmpcs.com/support/frontpage.htm
------------------------------
Date: 12 Feb 1998 10:49:54 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: ? Regular Expressions ?
Message-Id: <6bv5n2$3qk@panix.com>
In <34e318ef.0@news1.ibm.net> "Peter Perchansky" <fp@pmpcs.com> writes:
>Tom Christiansen wrote in message <6bqpkq$l7c$2@csnews.cs.colorado.edu>...
>> % man perlfaq4
>> % man perlfaq6
>I don't have access to telnet in order to look at manual pages. Can you
>point me to a web page?
http://language.perl.com/faq/
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Thu, 12 Feb 1998 13:51:29 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Alphabetical Comparison
Message-Id: <34e4fb00.1798775101@news.mmc.org>
On Thu, 12 Feb 1998 19:26:49 +0800, vertigan@iinet.net.au (Steve V) wrote:
>Sorry if this seems like a stupid question but I've read the FAQ on the sort
>function and am still unable to figure out how to do what I want. Basically
>I have to compare two string variables to see which is alphabetically
>"higher" than the other. Some thing like
>
>if ($string1 > $string2) {
>actions
>}
>
>except, of course, I'm testing to see which string comes first
>alphabetically. If anybody could shed some light on this for me I'd be much
>grateful.
>
>Thanks
>--Steve
A quick scan through the perlop documentation included with the standard Perl
distribution comes up with many hits on the word "string", some of which are in
a context relevant to your quest for knowledge.
There are operators for comparing strings, and operators for comparing numbers.
You're using the latter where the former is required. IOW, use gt instead of >.
For future reference: the FAQ, while immensely entertaining and highly useful,
is not the definitive documentation for Perl. It does, however, tell you where
the documentation is . . . please use the documentation. Start with:
$ perldoc perltoc
or
C:\>perldoc perltoc
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: 12 Feb 1998 15:18:07 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Alphabetical Comparison
Message-Id: <6bv3rf$asu$6@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, vertigan@iinet.net.au (Steve V) writes:
:Sorry if this seems like a stupid question but I've read the FAQ on the sort
:function and am still unable to figure out how to do what I want. Basically
:I have to compare two string variables to see which is alphabetically
:"higher" than the other.
Good for you. However, the answer to this one is in "perlop",
the manpage regarding perl operators.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
X-Windows: Never had it, never will.
--Jamie Zawinski
------------------------------
Date: Thu, 12 Feb 1998 10:10:24 -0500
From: Rick Meldrum <rjk@fprsdev3.fmr.com>
Subject: Argument parsing
Message-Id: <34E310E0.6BA7@fprsdev3.fmr.com>
Hi;
I want to turn a string into an argument list. For example
I have a string similar to a cron entry:
1 2 3 * * /bin/echo 'this is one arg'; /bin/echo 'this is another'
The catch is, I need to split this into a list that maintains the
quoted strings intact.
ie list[5] == /bin/echo list[6] == this is one arg
Any suggestions?
--
\ O(\ ___________________________________________
\ __\\\ ( Rick Meldrum - Unix Consultant, Hiker ()
\ \\\ ( Photographer, Brewer. ()
\ _\() (__________________________________________()
\_\| /\
\_| / \
\ / \
------------------------------
Date: 12 Feb 1998 15:32:49 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Argument parsing
Message-Id: <6bv4n1$cu2$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Rick Meldrum <rjk@fprsdev3.fmr.com> writes:
: ie list[5] == /bin/echo list[6] == this is one arg
:Any suggestions?
Two:
1. Check out the standard Text::ParseWords
2. Shorten your signature.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"Espousing the eponymous /cgi-bin/perl.exe?FMH.pl execution model is like
reading a suicide note -- three days too late."
--Tom Christiansen <tchrist@mox.perl.com>
------------------------------
Date: Thu, 12 Feb 1998 13:53:36 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: FAQless Forays (was: Code Example Needed)
Message-Id: <34e3feb5.15112723@news.tornado.be>
Russ Allbery <rra@stanford.edu> wrote:
>> I'd just like to point out that, in a properly moderated Perl newsgroup,
>> many of your recent posts would have to be rejected.
>> Not that I mind (too much).
>
>I doubt Tom would either. I think he'd very much appreciate an atmosphere
>in which he never once felt the urge to post the sorts of posts you're
>thinking of.
Actually I was thinking of the "White hats and black" (about Netscape's
release of the source code) and the Y2K problem articles. Both a very
good read, but not specifically Perl related.
Bart.
------------------------------
Date: 12 Feb 1998 14:33:27 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: FAQless Forays (was: Code Example Needed)
Message-Id: <6bv17n$8n8$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, rjk@coos.dartmouth.edu writes:
:Therefore, I disagree that all posts from PCs should be killfiled.
That's why I don't do it. It really isn't fair to posters like yourself
who have something worthwhile to say. It's like retroactively aborting
all the poor people. It would be a great cruelty and disservice, even
if it would clean up my own view of the world.
But I have been recently shocked at how many of the RTFMable postings
were from PCs. You're right that I made no attempt to statistically
verify that the good ones were not.
The reason I've answered every RTFM with just exactly which FM they
should R is so people get the notion that Perl comes with docs
that already contain the answer to their question.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
Chip Salzenberg sent me a complete patch to add System V IPC (msg, sem and
shm calls), so I added them. If that bothers you, you can always undefine
them in config.sh. :-) --Larry Wall in <9384@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 12 Feb 1998 14:35:26 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: FAQless Forays (was: Code Example Needed)
Message-Id: <6bv1be$j9f@news-central.tiac.net>
In article <6btmhc$f6k$3@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
>It is a non-thing. Deadness. Thus, it won't be tolerated.
Maybe it's just resting, or pining for the fjords?
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Thu, 12 Feb 1998 08:51:27 -0600
From: Olivier_Mary@studio.disney.com (Olivier Mary)
Subject: Re: FAQless Forays (was: Code Example Needed)
Message-Id: <887294457.1115881479@dejanews.com>
Tom,
I think what people reproach you is a kind of extremism in your point of
view but I think this "extremism" is valuable, it helps to shake things
up ! Maybe some people out there are going to start reading the faq and
the newsgroup before posting a question. If you don't shout loud people
won't listen. Keep up the good work !!! By the way is the perl compiler
year2000 compliant ? ;-)
Olivier
PS: Yes I'm posting from NT, but what I'm really using on it is netscape,
telnet on the unix servers and cc-mail...Not my decision to use
Billware.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Thu, 12 Feb 1998 15:11:50 GMT
From: malch@malch.com (Malcolm Hoar)
Subject: Re: FAQless Forays (was: Code Example Needed)
Message-Id: <6bv3fo$s4j$1@nntp1.ba.best.com>
In article <6bv17n$8n8$1@csnews.cs.colorado.edu>, tchrist@mox.perl.com (Tom Christiansen) wrote:
>But I have been recently shocked at how many of the RTFMable postings
>were from PCs.
Why? It's hardly surprizing.
Most of the new users (to the Net and Perl) are going to be
PC users because:
1. Most computer users *are* PC users
2. Those users that are UNIX-savvy figured out this stuff
a long, long time ago.
I'm afraid your only realistic choices are:
* Continue posting RTFM answers to RTFM questions, or
* Lead the drive for a moderated ng.
The former option won't (IMO) do anything to relieve your
frustration with the RTFM and off-topic posts here. As soon
as you supply one newbie with a clue, 10 more are going to
pop up. The 'demographics' of the Net pretty much guarentee
the trend will continue for a *long* time.
--
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| Malcolm Hoar "The more I practice, the luckier I get". |
| malch@malch.com Gary Player. |
| http://www.malch.com/ Shpx gur PQN. |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: 12 Feb 1998 15:30:18 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: FAQless Forays (was: Code Example Needed)
Message-Id: <6bv4ia$cu2$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, malch@malch.com (Malcolm Hoar) writes:
:* Continue posting RTFM answers to RTFM questions, or
``The beating shall continue until morale improves!'' :-)
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
Lazy people never bother to actually read the manual. Instead they (like
kids) pick something with big, colorful buttons.
-- Eugene Tyurin <gene@insti.physics.sunysb.edu>
------------------------------
Date: 12 Feb 1998 14:43:27 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: Forgery => Killfile
Message-Id: <6bv1qf$nl2$1@usenet87.supernews.com>
: If forging my address stops people replying, or reading my posts, then
: I can live with that.
I guess we all have to decide what our baby/bathwater tolerance ratios
are.
xoxo,
Andy
--
--
Andy Lester: <andy@petdance.com> http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com> http://ChicagoMusic.com/
------------------------------
Date: 12 Feb 1998 13:38:24 +0000
From: Zachary Kessin <zkessin@lhr-sys.dhl.com>
Subject: Re: Good Perl editors
Message-Id: <m3zpjxrlin.fsf@pc-hhu-52.lhr-sys.dhl.com>
>Someone asked about editors for perl.
I swear by emacs. A lot of people swear at it. You can get an NT
version which is Decent. If you use emacs with perl use the cperl.el
that comes with the perl source. Not the perl mode that comes with
emacs. I at least think the one that comes with perl is better. I
assume some people like the other one.
As for editors, its is a very personal choice. Try a few.
--Zachary Kessin
------------------------------
Date: Thu, 12 Feb 1998 08:59:27 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: How the Hell do I...?
Message-Id: <1d4bdol.1ualm0y1f90ohrN@roxboro0-019.dyn.interpath.net>
Dave Power <dave.power@adpdesign.com> wrote:
> Tom Christiansen <tchrist@mox.perl.com> wrote:
-snip-
>
> >:How do I delete a temporary file once it's finished with?
> That was my real question and you said...
>
> >
> > % man perlfunc | grep -i delete
> > [amongst other things ...]
> > XXXXXX Deletes a list of files. Returns the number
> > of files successfully deleted.
> >
> >The XXXXXX is left for you to lookup on your now. Although
> >if you read the FAQ, there's a way to do that (see the POSIX
> >module or the IO::File module) in which it's not even needed.
> >
> I've picked up the FAQ now - thanx (much better than the docs which
> came with my W95 version 4 of Perl) but I'm still confused.
>
> Maybe I've not had enough time to do a proper read thro' but pls tell
> me how - in simple terms - do I delete a file? I don't want a full
> course in the language - just one answer to one question.
post code that doesn't do what you expect and people will answer.
> PS If I should goto cgi-authoring pls tell me and I'll get out of your
> hair!
No, this is a FAQ, but it is a perl faq.
as for how to delete a file.
XXXXXX 'filename'; # this should do the trick
--
John Moreno
------------------------------
Date: 12 Feb 1998 15:05:26 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How the Hell do I...?
Message-Id: <6bv33m$asu$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Marc.Haber-usenet@gmx.de (Marc Haber) writes:
:Tom surely is working rather hard to get people to read the docs.
This is my only goal. Maybe I'll work out a standard response.
But some people will always be offended when they're told
that the answer they seek is on their own system. We must get
all users of perl to empower themselves to bother to look.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"It is easier to port a shell than a shell script."
--Larry Wall
------------------------------
Date: 12 Feb 1998 15:11:02 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Is this correct? File Locking
Message-Id: <6bv3e6$asu$4@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, rebel@wantree.com.au writes:
:I know this is a bit of an old subject, but I felt impelled to respond
:to it.
:I am, like Bill coming to terms with perl,cgi and unix (I'm on a windoze
:machine).
:perhaps you should not have been so hard on him.
:I can relate to his story, and he did choose wisely to consult the
:"experts" on the matter.
You have no idea how ugly that paragraph miswrapped. :-(
: sub lock {
: flock(MBOX,$LOCK_EX);
: # and, in case someone appended
: # while we were waiting...
: seek(MBOX, 0, 2);
: }
: sub unlock {
: flock(MBOX,$LOCK_UN);
: }
: open(MBOX, ``>>/usr/spool/mail/$ENV{'USER'}'')
: or die ``Can't open mailbox: $!'';
: lock();
: print MBOX $msg,"\n\n";
: unlock();
The problem was that when I wrote that, I didn't realize that
few people understood issues of stdio buffering. So in 5.004,
we changed LOCK_UN so it pre-flushes.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
At MIT the server is the unit of invention. --Rob Pike
------------------------------
Date: 12 Feb 1998 14:25:04 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Metacharacters and script security - advice please.
Message-Id: <6bv0o0$j9f@news-central.tiac.net>
In article <34e2280b.26848213@news.skynet.co.uk>,
User <networks@skynet.co.uk> wrote:
>Metacharacters and script security - advice please.
You might want to check out brian d foy's CGI MetaFAQ which has several
perl/cgi and security links on it. It's at
http://computerdog.com/CGI_MetaFAQ.html
You might also consider using the Net::SMTP module rather than calling
sendmail directly, it's in the libnet bundle on CPAN.
"Dangerous characters" vary depending on what you're about to hand them
off to, you might consider regex metacharacters dangerout if you get a
string from a user and use it as a regex pattern, (\Q \E can help), you
might consider HTML markup an avenue to abuse in a BBS style CGI script
(encode_entities can help out), shell metacharacters can be dangerous
(system LIST can avoid spawning a shell) for a shell calling external
programs. If you are thinking of sending user input to eval then look at
the Safe module or completely different ways of doing it.
If you end up using user input then use -T and check the data in a way
which allows in safe data rather than tries to exclude bad data.
Those are just a few random thoughts, the links of brian's page are very
useful...
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 12 Feb 1998 14:59:34 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Wizard Quiz
Message-Id: <6bv2om$asu$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, rjk@coos.dartmouth.edu writes:
:> Question: What's the difference between /^Foo/s and /^Foo/?
:>
:> Answer: There is no difference because /s only affects whether dot
:> can match newline.
:> Correct: No.
:> Why: /s does more than that.
:
:> Answer: The first would allow the match to cross newline boundaries.
:> Correct: No.
:> Why: /s only makes a dot able to cross a newline, and then
:> only if the string actually has a newline in it.
:
:These two statements appear to contradict each other. Could you clarify them?
Well, I see what you mean.
The point I was trying to convey was that with /s, you don't have to
worry about any settings of the old $* variable, which deprecated though
it may be, still shows up in older scripts that no one can be bothered to
upgrade (me included :-). That what the "does more than that" alludes to.
In the second case, I was trying to show that it doesn't matter
whether you can cross newline boundaries if your input data is
coming in just one line at a time.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
X-Windows: You'll envy the dead.
--Jamie Zawinski
------------------------------
Date: 12 Feb 1998 15:20:56 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perl-ftp problem
Message-Id: <6bv40o$asu$7@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, markos@student.math.hr (Marko Sunjic) writes:
:My program gets $file from $host,but if file is binary than it should <SNIP>
:and if it's only ascii file it should compare it to the file in my hom<SNIP>
:with system diff call...
:How can i tell if thew file is bin or ascii?
You will find that the perlfunc manpage, in the very first `function'
included in the `Alphabetical Listing of Perl Functions', covers this
nicely.
Alternatively, you can look at the tcgrep program I posted yesterday,
which operates only on text files.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"Just because something is obviously happening doesn't mean something obvious
is happening." --Larry Wall
------------------------------
Date: Thu, 12 Feb 1998 09:44:22 -0800
From: Stephen Foley <sfoley@magma.ca>
Subject: Problems with sendmail code
Message-Id: <34E334F6.23A2@magma.ca>
Hello,
I have attached the following perl code in hopes that somebody might
look at it and tell me what is wrong.
I am using this code so that somebody can fill out a form on the net and
the results emailed to me. However, upon filling out the fields on my
HTML form and submitting, I never do receive the email. It does forward
me to the confirmation page though....
I have properly configured the location of the sendmail program located
on my ISP as far as I know.
If anyone can help I would appreciate it!
Thanks,
steve
#!/usr/bin/perl5
#
# This splits up the passed arguments, or in other words, the
# fields from the form, into an array called args.
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# @args = split(/\&/, $ENV{'QUERY_STRING'});
@args = split(/\&/, $buffer);
# This goes through each entry in the args list and creates an
# associative array.
for (@args) {
$_ =~ s/\+/ /g;
$_ =~ s/\%(..)/sprintf("%c", hex($1))/eg;
($varName, $varValue) = split(/=/);
$variables{"$varName"} = $varValue;
}
# print "Content-type: text/html\n\n";
# print "<html>\n";
# print "<head><title>test</title></head>\n";
# print "<body>\n";
# print "<p>query_string = $buffer</p>\n";
# print "<p>content_length = $ENV{'CONTENT_LENGTH'}</p>\n";
# print "<p>question1 = $variables{'question1'}</p>\n";
# print "<p>question1a = $variables{'question1a'}</p>\n";
# print "</body>\n";
# print "</html>\n";
# exit;
# DO NOT CHANGE ANY LINE ABOVE THIS ONE!!!!!
# To change the email address of the person that the form is mailed
# to change the line below this one to the correct email address.
#
# NOTE: The backslash in front of the ampersand must be there or the
# script will not run.
#
$toaddr = "sfoley\@magma.ca";
# Open the mail client and begin to send
open (MAIL, "|usr/sbin/sendmail $toaddr");
# The From: and Subject: must be in the following two lines.
# You can change the text after them though to something suitable
# for your purpose.
print MAIL "From: Internet\n";
print MAIL "Subject: Global Driver Services\n\n";
print MAIL " --------------------------------------------\n\n";
print MAIL " Contact Information\n";
print MAIL " First Name\n ".$variables{"First Name"}."\n\n";
print MAIL " Last Name\n\n ".$variables{"Last Name"}."\n\n";
print MAIL " Address".$variables{"Address"}."\n";
print MAIL " City ".$variables{"City"}."\n";
print MAIL " Province".$variables{"Province"}."\n";
print MAIL " Postal Code".$variables{"Postal Code"}."\n";
print MAIL " Phone".$variables{"Phone"}."\n";
print MAIL " Date of Birth".$variables{"Date of Birth"}."\n";
print MAIL " License Class\n".$variables{"License Class"}."\n\n";
print MAIL " Other Related Work Experience\n ".$variables{"Other
Related Work Experience"}."\n\n";
print MAIL " General Comments\n".$variables{"General Comments"}."\n\n";
print MAIL "
-----------------------------------------------------------------------\n\n";
print MAIL " Trailer Experience\n";
print MAIL " A Trains".$variables{"A Trains"}."\n";
print MAIL " B Trains ".$variables{"B Trains"}."\n";
print MAIL " Reefer Vans ".$variables{"Reefer Vans"}."\n";
print MAIL " Dump Trailer ".$variables{"Dump Trailer"}."\n";
print MAIL " 48 Vans ".$variables{"48' Vans"}."\n";
print MAIL " 53' Vans".$variables{"53' Vans"}."\n";
print MAIL " Crane".$variables{"Crane"}."\n";
print MAIL " Tilt and Load ".$variables{"Tilt and Load"}."\n";
print MAIL " Flat Deck ".$variables{"Flat Deck"}."\n";
print MAIL " Dry Bulk Tank".$variables{"Dry Bulk Tank"}."\n";
print MAIL " Liquid Tank".$variables{"Liquid Tank"}."\n";
print MAIL " Auto Transport ".$variables{"Auto Transport"}."\n";
print MAIL " Double Drop Trailor".$variables{"Double Drop
Trailor"}."\n";
print MAIL " Single Drop Trailor".$variables{"Dry Bulk Tank"}."\n";
print MAIL " Shunt Truck".$variables{"Shunt Truck"}."\n";
print MAIL " Highway Coach ".$variables{"Highway Coach"}."\n";
print MAIL " Equipment Types ".$variables{"Equipent Types:"}."\n";
print MAIL " Other Trailer Experience".$variables{"Other Trailer
Experience"}."\n\n";
print MAIL "
-----------------------------------------------------------------------\n\n";
print MAIL " Training Endorsements \n";
print MAIL " TDG ".$variables{"TDG"}."\n";
print MAIL " Tow Motor".$variables{"Tow Motor"}."\n\n";
print MAIL " WHMI".$variables{"WHMI"}."\n\n";
print MAIL " Spill Recovery".$variables{"Spill Recovery"}."\n\n";
print MAIL "
-----------------------------------------------------------------------\n\n";
print MAIL " Certification\n";
print MAIL " Are you certified to drive in the
USA?".$variables{"usa"}."\n\n";
print MAIL " Crane Certification ".$variables{"Crane
Certification"}."\n";
print MAIL "
-----------------------------------------------------------------------\n\n";
print MAIL " Job Preferences\n\n";
print MAIL " Which of the following are you prepared to do?\n";
print MAIL " OTR, Highway Runs, Long Distance ".$variables{"OTR,
Highway Runs, Long Distance"}."\n";
print MAIL " Local Highway 0-400 KM ".$variables{"Local Highway
0-400 KM"}."\n";
print MAIL " City Work Days ".$variables{"City Work Days"}."\n";
print MAIL " City Work Nights".$variables{"City Work
Nights"}."\n\n";
print MAIL " City Work - Any Shift ".$variables{"City Work - Any
Shift"}."\n";
print MAIL " City Work Afternoons ".$variables{"City Work
Afternoons"}."\n";
print MAIL " Team Highway Runs ".$variables{"Team Highway Runs"}."\n";
print MAIL " Shunt Work ".$variables{"Shunt Work"}."\n";
print MAIL " Willing to work weekends ".$variables{"Willing to work
weekends"}."\n";
print MAIL "
-----------------------------------------------------------------------\n\n";
print MAIL " Load Unload \n\n";
print MAIL " Will you Load Unload?".$variables{"Will you Load
Unload?"}."\n";
print MAIL " If no, explain:".$variables{"Load Unload
Explanation"}."\n";
print MAIL " Handbomb".$variables{"Handbomb"}."\n";
print MAIL " Palletized".$variables{"Palletized"}."\n";
print MAIL " No. of Days willing to be away from home".$variables{"
days away from home"}."\n";
print MAIL "
-----------------------------------------------------------------------\n\n";
print MAIL " Work Location \n\n";
print MAIL " Greater Toronto Area - Metro, Brampton, Mississauga,
Concord ".$variables{"Greater Toronto Area"}."\n";
print MAIL " Burlington".$variables{"Burlington"}."\n";
print MAIL " Hamilton".$variables{"Hamilton"}."\n";
print MAIL " Other Location".$variables{"other location"}."\n";
print MAIL "
-----------------------------------------------------------------------\n\n";
print MAIL " Salary \n\n";
print MAIL " Expected Minimum Starting Wage\n";
print MAIL " Per Mile".$variables{"per mile"}."\n";
print MAIL " Per KM".$variables{"Per KM"}."\n";
print MAIL " Per Hour".$variables{"Per Hour"}."\n";
print MAIL " Minimum Annual Salary".$variables{"Minimum Annual
Salary"}."\n";
print MAIL " Pay System Comments".$variables{"Pay System
Comments"}."\n";
print MAIL "
-----------------------------------------------------------------------\n\n";
print MAIL " Driving Record \n\n";
print MAIL " Are you a driving school graduate?
".$variables{"driving school graduate"}."\n";
print MAIL " Any driving while impaired
convictions?".$variables{"driving while impaired"}."\n";
print MAIL " Any preventable motor vehicle accidents in the past 3
years?".$variables{"preventable motor vehicle accidents"}."\n";
print MAIL " If so, how many?".$variables{"preventable
accidents"}."\n";
print MAIL " How many years of experience?".$variables{"Years of
experience"}."\n";
print MAIL " Specific Years Experience".$variables{"Specific Years
Experience"}."\n";
print MAIL " Miles Experience".$variables{"Miles Experience"}."\n";
print MAIL " Moving Violations in the Past 3
years?".$variables{"Moving Violations in the Past 3 years"}."\n";
print MAIL " If so, how many? ".$variables{"moving
violations"}."\n";
print MAIL " Demerit Points ".$variables{"Demerit Points"}."\n";
print MAIL "
-----------------------------------------------------------------------\n\n";
print MAIL " Other Driver Service \n\n";
print MAIL " Are you presently working for anoher driver
service?".$variables{"other driver service"}."\n";
print MAIL " If yes, please indicate which
company:".$variables{"Other driver service company"}."\n";
print MAIL " Payrate ".$variables{"Payrate"}."\n";
print MAIL " Accounts".$variables{"Accounts"}."\n";
close(MAIL);
select(stdout);
$| = 1;
print <<END2;
Content-type: text/html\r
\r
<HTML>
<HEAD>
<TITLE>Global Driver Services Inc. - Proposed Layout</TITLE>
</HEAD>
<BODY BGCOLOR=\"#ffffff\"
BACKGROUND=\"../../demoweb/gds/preview/graphics/side.jpg"\"
LINK=\"#330099\">
<center>
<IMG SRC=\"../../demoweb/gds/preview/graphics/dcpdo.gif\" WIDTH=\"458\"
HEIGHT=\"54\" ALIGN=\"BOTTOM\"
NATURALSIZEFLAG=\"3\">
<h1>Thank you for your submission!</h1>
<P>
We will be in touch with you shortly!<P>
[ ISO 9002 ] [ Driver Leasing] [ Compliance ] [ Training ] [ Home ]<P>
If you have any questions or would like further information, email us
<P><A HREF=\"mailto:infro\@fordrivers.com\">info\@fordrivers.com</A>
</center>
</BODY>
</HTML>
END2
exit(0);
------------------------------
Date: 12 Feb 1998 14:57:28 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Problems with sendmail code
Message-Id: <6bv2ko$9ap@fridge.shore.net>
Stephen Foley (sfoley@magma.ca) wrote:
: I have attached the following perl code in hopes that somebody might
: look at it and tell me what is wrong.
1) You're not using CGI.pm
2) You're using some kind of strange form data parsing routine
3) You're not using sendmail judiciously
4) You're not checking for errors, at least not sending anything to
STDOUT
5) You're not using any modules (why not?)
6) Even if you don't use a module (modules?), you should try to get
rid of the 2,000 print statements by using a here doc.
: print MAIL " Reefer Vans ".$variables{"Reefer Vans"}."\n";
Dare I ask what a reefer van is? Do people travel in this vehicle to
cross the bong water?
--
Nathan V. Patwardhan
------------------------------
Date: 12 Feb 1998 15:22:57 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: scope of $<digit>
Message-Id: <6bv44h$asu$8@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
David Proffitt <D.M.Proffitt@mds.qmw.ac.uk> writes:
:This fragment checks lines of text for matching pairs of HTML style
:tags.
:I'm obviously missing something about the behaviour of $<digit> ?
No, what you wrote is really how it is supposed to work. I'm not quite
sure what your bug is. Although if it crosses a line boundary, I don't
know what you're going to do.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
The only disadvantage I see is that it would force everyone to get Perl.
Horrors. :-)
--Larry Wall in <8854@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 12 Feb 1998 14:59:59 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: SOURCE: tcgrep
Message-Id: <6bv2pf$asu$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, rjk@coos.dartmouth.edu writes:
:I'm curious why you used $* instead of /m and /s.
Old code. Patches accepted.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
pos += screamnext[pos] /* does this goof up anywhere? */
--Larry Wall, from util.c in the v5.0 perl distribution
------------------------------
Date: 12 Feb 1998 09:08:11 -0600
From: ilmar@csc.it.moc
Subject: STDIN input to perl debugger in emacs
Message-Id: <fhen18c144.fsf_-_@csc.ti.com>
#---------------------------------------------------------------
# e-mail address letter reversed; please reply to newsgroup
#---------------------------------------------------------------
How do I get the perl debugger to read lines from STDIN when using
it under emacs ? I tried (after typing in M-x perldb <return>)
Run perldb (like this): perl ./test.pl < input.file
and it doesn't seem to work. The code has the following structure:
while ( $line = <STDIN> ) {
do_something_here;
}
Any help would be much appreciated. Thanks.
------------------------------
Date: Thu, 12 Feb 1998 09:01:23 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: test!! please ignore this message i am seeing if it works!
Message-Id: <1d4benm.7zorye15s67hwN@roxboro0-019.dyn.interpath.net>
Russell Bornschlegel <kaleja@rahul.net> wrote:
> John Porter wrote:
> >
> > Brandon Blum wrote:
> > >
> > > never done a newsgroup before, trying to learn perl and i want
> > > to post,
> > > hopefully this works, just ignore it!
> >
> > Certainly never read a FAQ.
> > Never heard of netiquette.
> > First thing he does is spam our newsgroup!
>
> And you were never a newbie, I'm sure. How's he supposed to
> know that FAQs and netiquette exist if he hasn't read the
> newsgroups?
>
> At least he didn't post in all caps.
He's supposed to use his brain and read the group before posting.
Anybody that doesn't listen before talking is a idiot.
--
John Moreno
------------------------------
Date: 12 Feb 1998 15:49:39 GMT
From: "Paul Nielsen" <pnielsen@netins.net>
Subject: testing cgi-perl before submitting to server
Message-Id: <01bd37ce$6a4d8da0$4b0d8ea7@paul>
Is there a way to test a cgi script on my local windows 95 computer before
sending it to the computer that hosts the web site?
Some of the scripts I would like to work with would create a response web
page, telling the user that the information sent in the form has been
received, and repeat that information back to him.
I also want to create a web page on the fly, based on information checked
by the user.
It is very frustrating to create a script, ftp it to the server, and then
have to wait up to 30 minutes for the server to compile that script before
I can use it.
Thanks
Paul Nielsen
Agri-Education, Inc.
pnielsen@netins.net
------------------------------
Date: 12 Feb 1998 14:27:39 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Why is Tom Christiansen so rude?
Message-Id: <6bv0sr$7ed@fridge.shore.net>
David Rawle (info@channel-a.com) wrote:
: Well?
It's not that Tom is rude. He's politically incorrect and this
bothers most people who've been sitting on the fence.
*Plus*, he's one of the few people who are willing to voice their
unhappiness about the state of affairs here. It doesn't mean that
I always agree with him, but I've come to realize that it's better
when he's here.
--
Nathan V. Patwardhan
------------------------------
Date: 12 Feb 1998 16:02:37 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
Subject: Re: Why is Tom Christiansen so rude?
Message-Id: <7xlnvgvpbm.fsf@beavis.vcpc.univie.ac.at>
Re: Why is Tom Christiansen so rude?, David
<info@channel-a.com> said:
David> Well?
Probably because most (hmm, maybe) of the questions on this
group have answers which can be found in the documentation
you get with the language.
And a lot of the rest turn out to be WWW server or CGI or
browser specific anyway.
I know (of) a number of people who bailed out of giving help
in comp.info*.www.au*.cgi due to the huge number of FAQed
questions repeated over and over and over.
Interesting and well-thought-out questions on the other
hand, receive good treatment don't they?
I think Tom wants to help people here - it is mainly
frustration at this repetition of already answered FAQs.
Personally I like to find good questions in here and I try
to answer if I can (a good learning exercise IMHO). I just
ignore the FAQs. But that won't stop them. Perhaps perl
ought to throw up all the faq's every time you invoke the
interpreter? :-)
tony
------------------------------
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 1873
**************************************