[11933] in Perl-Users-Digest
Perl-Users Digest, Issue: 5533 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 1 04:07:15 1999
Date: Sat, 1 May 99 01:00:18 -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 Sat, 1 May 1999 Volume: 8 Number: 5533
Today's topics:
"unwebify" meme origin? (was Re: Checkbox is not workin <jbc@shell2.la.best.com>
Can I get multiple line or cut/paste input? <portboy@home.com>
Re: Can I get multiple line or cut/paste input? <rick.delaney@home.com>
Re: Can I get multiple line or cut/paste input? (David Efflandt)
Re: create directory with perl script? <rra@stanford.edu>
Re: Does mod_perl work with ActiveState Perl on NT? dalekh@hotmail.com
Re: Does mod_perl work with ActiveState Perl on NT? <randy@theory.uwinnipeg.ca>
Fill out someone else's form? (Jonathan Higbee)
Re: How to change the HTTP_REFERER?? (David Efflandt)
Re: How to flush CGI output? (David Efflandt)
Re: how to setup cgi (David Efflandt)
Re: Instance Data / Instance Variables <tchrist@mox.perl.com>
Re: Instance Data / Instance Variables <ebohlman@netcom.com>
need to encode a query string <abp@holly.colostate.edu.spamm>
Re: Newsfeed and Local Weather <tchrist@mox.perl.com>
Re: Newsfeed and Local Weather <uri@sysarch.com>
Re: Newsfeed and Local Weather <rra@stanford.edu>
Re: NT Perl vs UNIX Perl (Tad McClellan)
Obtaining remote server time under Win32? <gwrowntree@smartchat.net.au>
Re: using perl to manage passwords? (Steve MacLellan)
Re: using perl to manage passwords? (Sam Holden)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 01 May 1999 07:55:39 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: "unwebify" meme origin? (was Re: Checkbox is not working.)
Message-Id: <372ab37b$0$220@nntp1.ba.best.com>
David Cassell <cassell@mail.cor.epa.gov> wrote:
> jeffrey_f@my-dejanews.com wrote:
>>
>> The problem is it only saves the last checkbox (last field in the HTML). I
>> can figure out why!! Happens with any checkboxes...name doesnt matter, value
>> doesnt...weird.
snip...
> But if you choose to psot there, please give a more helpful message
> than this one... This might help someone without psychic powers
> figure out what your problem is.
Actually, the answer seems pretty obvious, even without the psychic
powers: his CGI script is using a hash to store the fieldname/value
pairs from an HTML form, and it isn't clever enough to deal with
checkboxes, where one fieldname can be associated with multiple checked
boxes (and hence, with multiple values). This is commonly seen with
that chunk of cargo-cult form decoding that seems to find its way into
every novice CGI scripter's cut-and-paste collection:
[begin archaeological relic]
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# Stop people from using subshells to execute commands
# Not a big deal when using sendmail, but very important
# when using UCB mail (aka mailx).
# $value =~ s/~!/ ~!/g;
$FORM{$name} = $value;
}
[end relic]
One can make the same mistake with CGI.pm, of course; the idea is to
avoid overwriting the previous value if one already exists, using
something like this:
if ($FORM{$name}) {
$FORM{$name} .= "\n$value";
} else {
$FORM{$name} = $value;
}
The interesting thing about this (for me, at least), and the reason
I've presumed to actually respond to the original comment (as opposed
to joining the chorus of droll, off-topic posts lamenting the group's
incidence of off-topic posts), is that I wanted to see if anyone around
here happens to know the original author of this piece of code. The
associated comments seem to have a remarkable ability to survive
intact, allowing one to trace appearances of it back quite a ways; for
example, see:
http://www.ncsa.uiuc.edu/SDG/IT94/Proceedings/EarSci/boston/ISMAP_form_script1.html
where it appears in a presentation given by Tony Boston to the Second
World Wide Web Conference; the script is dated June 1994, and appears
in an example on using imagemaps to present environmental research data.
Does anybody know of any earlier appearances? Boston credited Rob
McCool at NCSA in his paper's references section, and linked to:
http://hoohoo.ncsa.uiuc.edu/cgi/overview.html
though the page there no longer seems to contain any (obvious) links to
the broken code in question. I'd be very interested (well, mildly
interested) in hearing if anyone remembers it appearing in any early
form-decoding examples at hoohoo. I've got this particular piece of
code floating around in a couple of my oldest CGI scripts, and suspect
I might have picked it up from there.
Grepping for 'Un\-Webify plus signs' in the cgi directories of a
smallish ISP's shared Web server reveals no fewer than 38 matches. From
the memetic perspective, it could be argued that the only purpose of
Perl, the Web, and the entire culture of Unix was to provide a vehicle
whereby the spectacularly successful "Un-Webify plus signs and
%-encoding" meme could propagate itself.
It was in the hopes of getting a slightly deeper perspective on this
issue that I chose to post this here, by the way, rather than causing
even further confusion for the luckless (and historically challenged)
inhabitants of c.i.w.a.c. My apologies to those who construe the
c.l.p.m. CGI prohibition strictly.
--
John Callender
jbc@west.net
http://www.west.net/~jbc/
------------------------------
Date: Sat, 01 May 1999 04:17:45 GMT
From: Mitch <portboy@home.com>
Subject: Can I get multiple line or cut/paste input?
Message-Id: <372A80D5.6A91B922@home.com>
Okay, when my script is running, I need to prompt a user for input that
contains multiple lines. The user will probably only cut and paste into
this portion. So here's what it
should look like:
prompt>
input something aseodhasdlkfja;sldkjfa;ldksjf
asdfaadsfSDfasdfasdfasdfasdfadsfasdfasdfasdfasdf
sdfasdlfkjalsdkjfa;lsdkjf;laksdjf;laksdjf;laksdjf
asdfasdlfkja;sdlkfjal;skdjfl;aksdjf;laksdjf;laksdjf
asdfa;lksdjf;alskdjf;lasdkjf;laskdjf;alsdkjf
...
prompt>
The user can either input or cut/paste in the stuff, and then on the
final line hit three .'s and then the contents should be written to a
file. Can this be done in PerL? If so, can somebody give me some
direction on finding the solution to this question.
Thanks,
Mitch
------------------------------
Date: Sat, 01 May 1999 04:39:03 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Can I get multiple line or cut/paste input?
Message-Id: <372A8504.59AC1CB6@home.com>
[posted & mailed]
Mitch wrote:
>
> The user can either input or cut/paste in the stuff, and then on the
> final line hit three .'s and then the contents should be written to a
> file. Can this be done in PerL? If so, can somebody give me some
> direction on finding the solution to this question.
The solution is at your fingertips in your Perl documentation. This is
just simple i/o for which there are lots of examples in the faqs and
docs. The only thing you might have trouble finding is the easy way to
stop user input on 3 dots.
You can just set the input record separator special variable, $/, as
described in the perlvar manpage. I have set it to "...\n" instead of
just '...' because stdin is line buffered.
$/ = "...\n";
my $input = <STDIN>;
open FH, ">$file" or die "Can't open $file: $!\n";
print FH $input;
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: 1 May 1999 05:28:37 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Can I get multiple line or cut/paste input?
Message-Id: <slrn7il455.jh.efflandt@efflandt.xnet.com>
On Sat, 01 May 1999 04:17:45 GMT, Mitch <portboy@home.com> wrote:
>Okay, when my script is running, I need to prompt a user for input that
>contains multiple lines. The user will probably only cut and paste into
>this portion. So here's what it
>should look like:
>
>prompt>
>input something aseodhasdlkfja;sldkjfa;ldksjf
>asdfaadsfSDfasdfasdfasdfasdfadsfasdfasdfasdfasdf
>sdfasdlfkjalsdkjfa;lsdkjf;laksdjf;laksdjf;laksdjf
>asdfasdlfkja;sdlkfjal;skdjfl;aksdjf;laksdjf;laksdjf
>asdfa;lksdjf;alskdjf;lasdkjf;laskdjf;alsdkjf
>...
>prompt>
>
>The user can either input or cut/paste in the stuff, and then on the
>final line hit three .'s and then the contents should be written to a
>file. Can this be done in PerL? If so, can somebody give me some
>direction on finding the solution to this question.
Easy:
#!/usr/local/bin/perl
print "Type or paste something and ... on new line to quit:\n\n";
while ($_ = <STDIN>) {
last if /^\.\.\.$/;
push @lines, $_;
}
print "You entered:\n\n", @lines, "\n";
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: 01 May 1999 00:30:55 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: create directory with perl script?
Message-Id: <ylyaj9b61c.fsf@windlord.stanford.edu>
Charles R Thompson <design@raincloud-studios.com> writes:
> I had 0775 at first, but wondered if it was a bad idea to start someone
> off leaving directories open like that.
The key additional thing to be aware of is that the mode you give to mkdir
is modified by your current umask. So you wouldn't be leaving the
directory open like that unless you had a umask of 002 when you were
running the script, and if you did it was probably for a good reason.
(Like using a Red Hat system with per-user groups.)
Provided that your umask is sane (and this isn't *always* a good
assumption; some SysV Unixes have a bad habit of using a umask of 000 when
running init scripts, Solaris in particular), you can generally get away
with just using 0777 with mkdir. That being said, I personally tend to
use 0755 out of paranoia.
But then, I don't use per-user groups on my Linux machines either.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Sat, 01 May 1999 05:09:14 GMT
From: dalekh@hotmail.com
Subject: Re: Does mod_perl work with ActiveState Perl on NT?
Message-Id: <372a8be6.72007160@news.flash.net>
There is a precompiled binary at perl.apache.org. Its something like
5.00502
On Fri, 30 Apr 1999 19:58:05 -0500, "Snehanshu Shah"
<s_shah@ix.netcom.com> wrote:
>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: Sat, 1 May 1999 00:51:02 -0500
From: "Randy Kobes" <randy@theory.uwinnipeg.ca>
Subject: Re: Does mod_perl work with ActiveState Perl on NT?
Message-Id: <7ge538$kqp$1@canopus.cc.umanitoba.ca>
Snehanshu Shah <s_shah@ix.netcom.com>
wrote in message news: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.
Hi,
I believe that binaries of mod_perl available on CPAN won't work
with ActiveState. On the mod_perl mailing list (links to the archives
are available at http://perl.apache.org/) there was a recent thread of
building mod_perl to work with ActiveState - I don't think a working
build has been successful yet. It does compile and work fine on
a native perl build without PERL_OBJECT, though - if you really need
mod_perl, you might consider building your own perl (without PERL_OBJECT)
and then building mod_perl from there - it's relatively straightforward.
Alternatively, the README.win32 file in the perl source distribution
suggests
using the C-API for linking a PERL_OBJECT build with extensions that won't
compile under PERL_OBJECT - I don't know if this would work in this case.
Best regards,
Randy Kobes
--
Physics Department Phone: (204) 786-9399
University of Winnipeg Fax: (204) 774-4134
Winnipeg, MB R3B 2E9 http://theory.uwinnipeg.ca/
Canada randy@theory.uwinnipeg.ca
------------------------------
Date: Fri, 30 Apr 1999 14:26:48 GMT
From: petcrows@bigfoot.com (Jonathan Higbee)
Subject: Fill out someone else's form?
Message-Id: <3729bbfa.1039453@news.ieighty.net>
Greetings.
How specifically can I use Perl to do the following:
1. Open up a window on some other site.
2. Fill in their form with the info I choose.
3. Submit their form.
I would like people to enter a bit of data on my page in my
form, then take that data and use it as input for a form on
someone elses page, and also add some of my own pre-set
data.
Perhaps what I need is a way to browse the web using Perl,
so I can plug what a user enters in a form on my page, into
the form on someone else's page.
Any specific ideas & examples I could learn from?
Jonathan Higbee - petcrows@bigfoot.com
++++
http://www.geocities.com/Athens/Atrium/1424/
------------------------------
Date: 1 May 1999 05:49:45 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: How to change the HTTP_REFERER??
Message-Id: <slrn7il5cp.jh.efflandt@efflandt.xnet.com>
On Wed, 28 Apr 1999 16:31:12 GMT, Tim@Globalvision.com
<Tim@Globalvision.com> wrote:
>Hi There
>
> Is it possible to trick the CGI script of a foreign host to think that the
>HTTP_REFERER is some thing different than what it really is. I have this
>script that links to another script on a different server, but the foreign
>script checks the referer and thus refuses to compute the data sent from my
>script
>
> Hope that you can help me
>
>
> Tim
Wrong newsgroup, but did you try sending a Referer: header along with the
other headers? Just to confuse people who log browsers, I sometimes use
this in the headers:
User-agent: Mozilla/4.08 (compatible; Perl 5.0; any OS)
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: 1 May 1999 05:55:26 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: How to flush CGI output?
Message-Id: <slrn7il5nh.jh.efflandt@efflandt.xnet.com>
On 29 Apr 1999 21:28:11 GMT, JUNYI J LIN <jlmy@orion> wrote:
>I am having problem to flush output to the screen
>in a CGI program. To demonstrate my problem, I
>wrote this little CGI below.
>
>
>#!/usr/bin/perl
>
>print "Content-type: text/html\n\n";
>print "hello world!\n";
>
>#assume that I do a lot of stuff here which
>#takes 10 seconds.
>sleep(10);
>
>exit;
>
>
>This little CGI will not display "hello world"
>on the browser screen until it finished the
>10 second sleep.
>
>I tried to call flush(STDOUT) right before the
>sleep call, but it didn't help at all. It seems
>like the web server is caching it.
The web server is caching it. And some browsers do not display the page
until all text is received, so it knows how to render it. Further
discussion on this topic should be directed to a newsgroup related to your
webserver or CGI.
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: 1 May 1999 06:00:09 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: how to setup cgi
Message-Id: <slrn7il60d.jh.efflandt@efflandt.xnet.com>
On Wed, 28 Apr 1999 15:32:05 GMT, mk <mk@best.com> wrote:
>Hi everybody,
>
>Please help me on this matter, I try to run perl script on my system,
>it works with pl files, but when I run cgi, it just displays the
>content of the files, any info will help, tia.
This subject is unrelated to Perl. It sounds like a webserver
configuation problem. Please direct such questions to a newsgroup related
to your webserver (and include webserver program name and OS). You don't
give a clue what your 'system' is.
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: 30 Apr 1999 22:08:05 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Instance Data / Instance Variables
Message-Id: <372a7e25@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Uri Guttman <uri@sysarch.com> writes:
:>>>>> "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.
It's a playful form of demuring antiaggression.
% agrep -3 disgression /usr/dict/words | grep ^d|words
degression digression's discretionarily dispassionately
depression digressive discretionary dispassionateness
depression's digressively discussion dispassioned
digestion digressiveness discussional dispersion
digestional digressory discussionism dispersions
digressing discission discussionist dissension
digressingly discreation discussion's dissension's
digression discretion disgregation distressedness
digressional discretional dismission distressing
digressionary discretionally dispassionate distressingly
% grep 'gression$' /usr/dict/words | words
aggression ingression photoregression retrogression
antiaggression introgression preaggression semidigression
degression nonaggression pretergression subingression
digression nonregression progression transgression
egression nontransgression regression unaggression
--tom
--
"I do not feel obliged to believe that the same God who endowed us with sense,
reason and intellect has intended us to forgo their use." -- Galileo Galilei
------------------------------
Date: Sat, 1 May 1999 04:32:34 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Instance Data / Instance Variables
Message-Id: <ebohlmanFB1DyA.C3y@netcom.com>
Tom Christiansen <tchrist@mox.perl.com> wrote:
: % agrep -3 disgression /usr/dict/words | grep ^d|words
: degression digression's discretionarily dispassionately
[snip]
Curiously, the list doesn't include 'distression', which, I presume,
would be an accurate description of your emotional state if you were ever
to discover a DNS server with an entry for 'microsoft.gov'.
------------------------------
Date: Sat, 1 May 1999 00:20:57 -0600
From: "Aaron Propst" <abp@holly.colostate.edu.spamm>
Subject: need to encode a query string
Message-Id: <7ge6e2$1c3k@yuma.ACNS.ColoState.EDU>
I need to write a part of a script that can create a query string from a
text string.
I need to be able to pass a text string with punctuation to it, and have it
translate it to hex values (i.e. %20 for spaces)
Anyone know of a simple way to do this?
thanks
Aaron Propst
------------------------------
Date: 30 Apr 1999 22:06:34 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Newsfeed and Local Weather
Message-Id: <372a7dca@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Uri Guttman <uri@sysarch.com> writes:
: TC> .SH AUTHOR
: TC> Larry Wall
:
:forging that name is no excuse for nroff in perl! he should know pod!
:when was this written?
Not so long ago and not so far away. And by Larry. How can we
forget our beloved wrapman, of not dissimilar provenance.
--tom
#!/usr/bin/perl
# Usage: wrapman [files]
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
= localtime(time);
$month = (January,February,March,April,May,June,
July,August,September,October,November,December)[$mon];
$user = $ENV{'USER'} || $ENV{'LOGNAME'} || (getpwuid($<))[0];
$fullname = (getpwnam($user))[6];
$fullname =~ s/.*-\s*(.*)\(.*//;
$fullname =~ s/,.*//;
substr($user,0,1) =~ tr/a-z/A-Z/;
$fullname =~ s/&/$user/; # Propagate the & abomination.
$log = '$' . 'Log' . '$';
$header = '$' . 'Header' . '$';
foreach $file (@ARGV) {
# Generate various strings for the manual page.
($prog = $file) =~ s/\.\w+$//;
($PROG = $prog) =~ y/a-z/A-Z/;
$Prog = $prog; substr($Prog,0,1) =~ y/a-z/A-Z/;
# See if we really want to wrap this file.
open(IN,$file) || next;
$/ = "\n";
$line1 = <IN>;
next unless $line1 =~ /perl/;
$line1 .= <IN> if $line1 =~ /eval/;
$line1 .= <IN> if $line1 =~ /argv/;
$line2 = <IN>;
next if $line2 eq "'di';\n";
# Pull the old switcheroo.
($dev,$ino,$mode) = stat IN;
print STDERR "Wrapping $file\n";
rename($file,"$file.bak");
open(OUT,">$file");
chmod $mode, $file;
# Spit out the new script.
print OUT $line1;
print OUT <<EOF;
'di';
'ig00';
#
# $header
#
# $log
EOF
# Copy entire script.
undef $/;
$_ = <IN>;
print OUT $line2, $_;
# Now put the transition from Perl to nroff.
# (We prefix the .00 below with $null in case the wrapman
# program is itself wrapped.)
print OUT <<EOF;
###############################################################
# These next few lines are legal in both Perl and nroff.
$null.00; # finish .ig
'di \\" finish diversion--previous line must be blank
.nr nl 0-1 \\" fake up transition to first page again
.nr % 0 \\" start at page 1
'; __END__ ##### From here on it's a standard manual page #####
.TH $PROG 1 "$month $mday, 19$year"
.AT 3
.SH NAME
$prog \\- whatever
.SH SYNOPSIS
.B $prog [options] [files]
.SH DESCRIPTION
.I $Prog
does whatever.
.SH ENVIRONMENT
No environment variables are used.
.SH FILES
None.
.SH AUTHOR
$fullname
.SH "SEE ALSO"
.SH DIAGNOSTICS
.SH BUGS
EOF
close IN;
close OUT;
}
__END__
--
Perl is designed to give you several ways to do anything, so
consider picking the most readable one.
--Larry Wall in the perl man page
------------------------------
Date: 01 May 1999 00:39:36 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Newsfeed and Local Weather
Message-Id: <x7eml15rp3.fsf@home.sysarch.com>
>>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:
TC> #!/usr/bin/perl
no use strict or -w
TC> # Usage: wrapman [files]
TC> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
TC> = localtime(time);
only $mon, $year and $mday are used. use strict would have caught
that. better to use a list slice.
TC> $month = (January,February,March,April,May,June,
TC> July,August,September,October,November,December)[$mon];
barewords!! (use strict would have found that) use qw() instead
TC> substr($user,0,1) =~ tr/a-z/A-Z/;
ucfirst is simpler and supports locale
TC> ($PROG = $prog) =~ y/a-z/A-Z/;
why y here and tr before? not very consistant.
TC> open(IN,$file) || next;
TC> $/ = "\n";
this is silly. $/ is undef'ed later but that should be localized
removing the need to reset $/ to \n
TC> open(OUT,">$file");
no check of the result of open!!
TC> chmod $mode, $file;
or of chmod!!
TC> undef $/;
local $/ in a block would be simpler.
TC> $_ = <IN>;
why use $_ when it is not used as a default arg. it is kinda misleading.
TC> print OUT $line2, $_;
instead of the $/ stuff, just do
print OUT $line2, <IN> ;
both slurp in the entire file and this eliminates 3 useless lines of code.
TC> print OUT <<EOF;
at least he uses here docs!!
TC> .TH $PROG 1 "$month $mday, 19$year"
Y2K Alert!!!
for someone who created perl, he shows not the best programming style
here. i wouldn't use this code as an example to a class on perl style.
i hope this will be taken by larry in the spirit it is given! i even
wonder if he will see it as he doesn't lurk here anymore, maybe tom
could forward it to him.
even so, i can't believe i am criticising larry's perl code.
:-)
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: 01 May 1999 00:37:24 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Newsfeed and Local Weather
Message-Id: <ylvhedb5qj.fsf@windlord.stanford.edu>
Uri Guttman <uri@sysarch.com> writes:
> for someone who created perl, he shows not the best programming style
> here. i wouldn't use this code as an example to a class on perl style.
> i hope this will be taken by larry in the spirit it is given! i even
> wonder if he will see it as he doesn't lurk here anymore, maybe tom
> could forward it to him.
> even so, i can't believe i am criticising larry's perl code.
I don't think TIMTOWTDI is just a theoretical concept to Larry. The
script works. :) Perl lets you write well-structured and well-maintained
code and it also lets you just solve problems. I, probably like you, try
to always write well-structured code, but there are a bunch of scripts I
use all the time which wouldn't have existed at all if I'd been forced to
always take the time to write them cleanly. (And hence probably would
never have existed were I using some other language that "enforced" good
style.)
The fact you can use barewords in Perl is still a feature. :)
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Fri, 30 Apr 1999 21:15:22 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: NT Perl vs UNIX Perl
Message-Id: <ajkdg7.pr.ln@magna.metronet.com>
news.boeing.com (jim.ray@west.boeing.com) wrote:
: Such commands like CHDIR in UNIX does not work with NT. Well at least it
: does not work with my code.
Unix does not _have_ a CHDIR command.
Neither does Perl.
Perhaps you meant chdir()
??
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 1 May 1999 15:44:20 +1000
From: "Greg Rowntree" <gwrowntree@smartchat.net.au>
Subject: Obtaining remote server time under Win32?
Message-Id: <7ge4hi$9c7$1@perki.connect.com.au>
I'm endeadouring to obtain the time on a remote WinNT workstation using the
Win32 NetRemoteTOD function, but the $time_info structure comes back pretty
empty. Can anyone out there help? Is there a better way?
Thanks
Greg
use Win32::Api;
# import remote time function
my ($NetRemoteTod) = new Win32::API ('netapi32', 'NetRemoteTOD', [P, P], N);
# define time structure
my ($time_info) = pack ("L6lL5", 0,0,0,0,0,0,0,0,0,0,0,0);
# get time info from remote $server
my ($server) = '';
if (!$NetRemoteTod->Call ($server,$time_info)) {
# got time okay, so unpack into tod vars
my ($tod_elapsedt,$tod_msecs,$tod_hours,$tod_mins,$tod_secs,$tod_hunds,
$tod_timezone,$tod_tinterval,$tod_day,$tod_month,$tod_year,$tod_weekday)
=
unpack ("L6lL5",\$time_info);
printf "$tod_hours:$tod_minutes:$tod_secs\n";
}
------------------------------
Date: Sat, 01 May 1999 05:26:32 GMT
From: maclell@col.ca (Steve MacLellan)
Subject: Re: using perl to manage passwords?
Message-Id: <372a9b28.18170268@news.tor.metronet.ca>
On Fri, 30 Apr 1999 11:52:10 -0400, tadmc@metronet.com (Tad McClellan)
wrote:
>Dan Baker (dtbaker@bus-prod.com) wrote:
>: I need to implement some password protected areas of a website... can
>
>: I'm sure the group would all learn a lot!
>
>
> I'm sure many in the group would not want to see how to do
> that because they do not care about the WWW.
I'm new here; new to Perl. You must be the leader?
Hmmm! Excuse my newbie foolishness. I assumed the World Wide Web
consisted of things like a graphical fromat, Usenet, Telnet, E-mail,
gohers. I thought the WWW encompassed the whle meal deal here, but I
guess not...not as far as your little corner of the WWW. And you are
the leader right? I know, I can tell by the BIG mouth.
>
> This is the Perl newsgroup. We talk about Perl type stuff here.
(he-he)
I knew that is why you were the leader, besides the BIG mouth you are
a bright boy.
>
> Perl is not equivalent to the WWW.
My, my, you are just too clever.
>
> In fact, most Perl programming has nothing to do with the WWW.
>
You must be related to Alan over at CIWAH
>
>
> WWW type stuff is discussed in the comp.infosystems.www.*
> newsgroups.
>
> Please do not have a WWW discussion in the Perl newsgroup,
> have it in a WWW newsgroup.
Tad, you might realize that for us newbies who don't have a handle on
all this but not be EXACTLY sure of where to post questions to. But
lucky for us there are a few of you BIG mouths in every group who
loudly like to DOMINATE over the newbies and set them straight.
Let's get one thing straight. I'm a forty year old man who isn't going
to let some snot nose pompous asshole tell me what I can post and what
I can't.
I'll tell you what....You see a message with my signature on it, just
don't bother reading it. OK?
Good good. I'm glad we got that cleared up. Now that we are on
friendly terms Tad perhaps you would like to choke out the answer to
the question:
>: I need to implement some password protected areas of a website... can...
Don't know it? Gee...and here I mistook you for the leader.
Regards,
Steve MacLellan
_______________________________________
Dog BYTE FREE Classifieds
Newsletter and discussion
For Internet Marketers
http://welcome.to/dogbyte
_______________________________________
------------------------------
Date: 1 May 1999 06:32:57 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: using perl to manage passwords?
Message-Id: <slrn7il80o.nl3.sholden@pgrad.cs.usyd.edu.au>
On Sat, 01 May 1999 05:26:32 GMT, Steve MacLellan <maclell@col.ca> wrote:
>On Fri, 30 Apr 1999 11:52:10 -0400, tadmc@metronet.com (Tad McClellan)
>wrote:
>
>>Dan Baker (dtbaker@bus-prod.com) wrote:
>>: I need to implement some password protected areas of a website... can
>>
>>: I'm sure the group would all learn a lot!
>>
>>
>> I'm sure many in the group would not want to see how to do
>> that because they do not care about the WWW.
>
>I'm new here; new to Perl. You must be the leader?
>Hmmm! Excuse my newbie foolishness. I assumed the World Wide Web
>consisted of things like a graphical fromat, Usenet, Telnet, E-mail,
>gohers. I thought the WWW encompassed the whle meal deal here, but I
>guess not...not as far as your little corner of the WWW. And you are
>the leader right? I know, I can tell by the BIG mouth.
I always thought the WWW consisted of the World Wide Web. The http section
of the internet. Nothing to do with usenet, telnet, or email. I'm sure they
are much older than this whole web thing...
But if you don't want to use the names that everyone else agrees on and
call everything related to the internet the WWW that's fine - no one
else will understand you of course, but that doesn't matter.
Even using your definition. This group is about perl, it is not about
the WWW, or telnet, or usenet, or email, or gopher. It's about a little
programming language called perl, which works perfectly well without
the whole internet thing on my laptop...
>
>>
>> This is the Perl newsgroup. We talk about Perl type stuff here.
>(he-he)
>I knew that is why you were the leader, besides the BIG mouth you are
>a bright boy.
>
>>
>> Perl is not equivalent to the WWW.
>
>My, my, you are just too clever.
>>
>> In fact, most Perl programming has nothing to do with the WWW.
>>
>You must be related to Alan over at CIWAH
>
>>
>>
>> WWW type stuff is discussed in the comp.infosystems.www.*
>> newsgroups.
>>
>> Please do not have a WWW discussion in the Perl newsgroup,
>> have it in a WWW newsgroup.
>
>Tad, you might realize that for us newbies who don't have a handle on
>all this but not be EXACTLY sure of where to post questions to. But
>lucky for us there are a few of you BIG mouths in every group who
>loudly like to DOMINATE over the newbies and set them straight.
But of course you refuse to listen and still post here. Meaning your
question is left unanswered, since the people who know the answer
read another group. Something over in comp.infosystems.www.*. They don't
all read this newsgroup. Do you often go to the local Butcher and ask
them how much a MacDonalds burger costs - they deal with meat and
burgers have meat so they must know the answer - right? You probably
wouldn't. But you will discuss how to some WWW stuff over in a perl
group, because after all some of the WWW uses perl so they must know the
answers...
>
>Let's get one thing straight. I'm a forty year old man who isn't going
>to let some snot nose pompous asshole tell me what I can post and what
>I can't.
>I'll tell you what....You see a message with my signature on it, just
>don't bother reading it. OK?
Congratulations on getting yourself plonked by the very people that might
be able to answer any future questions you have.
>
>Good good. I'm glad we got that cleared up. Now that we are on
>friendly terms Tad perhaps you would like to choke out the answer to
>the question:
>>: I need to implement some password protected areas of a website... can...
>
>Don't know it? Gee...and here I mistook you for the leader.
A leader doesn't really make any sense in a forum like this. All Tad is is
someone who knows more than you will ever know about perl (given his
current knowledge, and your knack for not wanting to listen to someone
who knows more than you).
The answer is simply, the same way you would do in C or sh or python.
--
Sam
the Emacs editor is horrible
--Linus Torvalds
------------------------------
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 5533
**************************************