[13030] in Perl-Users-Digest
Perl-Users Digest, Issue: 440 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 10 02:07:12 1999
Date: Mon, 9 Aug 1999 23:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 9 Aug 1999 Volume: 9 Number: 440
Today's topics:
Re: 1999 FORML Conference Call for Papers (Abigail)
Re: bracket syntax (Abigail)
Cheap web site configuration to grow in <mats.nygren@swipnet.se>
Re: diff in perl? (Mark-Jason Dominus)
Re: How do I pass arguments from one CGI script to anot <callen@boxcar.driver8.org>
Loading a web page (Phil Goetz)
Looking for a good Perl Book <mprender@virtualis.com>
Re: Looking for a good Perl Book <uri@sysarch.com>
Re: Looking for a good Perl Book (Bill Moseley)
Re: Perl Question <mprender@virtualis.com>
Re: perl script - help (Abigail)
Re: perl script - help (Abigail)
Re: pricing a perl job (Abigail)
Re: print to file using here document (Abigail)
Re: print to file using here document (Abigail)
Re: print to file using here document (Martien Verbruggen)
Re: Replace section in file with another file (Abigail)
Re: Stopping someone from getting my cgi-scripts (Abigail)
suggestions for CRAP <uri@sysarch.com>
Testing <stupid@people.comos>
turn $6 into $6000 <discouts@home.com>
Re: turn $6 into $6000 <uri@sysarch.com>
Re: UpperCase first letter of string only. (Abigail)
Re: User Authentication (Abigail)
Re: User Authentication (Abigail)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Aug 1999 00:53:37 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: 1999 FORML Conference Call for Papers
Message-Id: <slrn7qvfij.ahe.abigail@alexandra.delanet.com>
Rich Wagner (drsavage@montrose.net) wrote on MMCLXIX September MCMXCIII
in <URL:news:01bee276$4fd61100$f1c385cc@bernoulli>:
//
// My name is Rich Wagner. I have been appointed by the Forth Interest Group
// as the director and chairman of your 1999 FORML Conference.
Wow! Did they make a big mistake!
I would never appoint someone to be a chairman of a Forth conference if
he thinks 'forth' is spelled 'perl'.
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 10 Aug 1999 01:02:39 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: bracket syntax
Message-Id: <slrn7qvg3f.ahe.abigail@alexandra.delanet.com>
Abominable Sonoman (anita.villanueva@intel.com) wrote on MMCLXIX
September MCMXCIII in <URL:news:37AF1408.F8D405B7@intel.com>:
"" I have been writing Perl scripts for a few weeks now, and from time to
"" time i've been coming across some rather strange syntax warnings/errors.
""
"" for example, sometimes when i say something like
""
"" $something = "file";
"" $exp = "abc";
""
"" $word = $something.${exp}_1234; #say this is line 56
""
"" the unix thing complains, saying "Ambiguous use of ${exp} resolved to
"" $exp at line 56" or something like that. But if I take the brackets out,
""
"" it thinks the variable is $exp_ so i get a null value for it, and $word
""
"" becomes "file.1234". I am not even using the -w switch so I don't
"" understand why I am getting this warning. I run the program anyway and
"" it runs okay, but I don't understand why I am getting this warning in
"" this case, because I use the brackets similarly in other situations and
"" it doesn't complain there. I don't get what's so "ambiguous" about my
"" use of brackets here. On page 44 of "Learning Perl" it says you can use
"" brackets
"" as i did above as a delimiter....
Yes, in general you can. But sometimes, it can be ambiguous. Did you
read 'man perldiag' to find out what the warning means?
Note that 5.005 behaves slightly different.
But are you sure that $something.${exp}_1234; compiles? It doesn't
seem valid at all, and I can't get it to compile.
"" also, i got a similar error in another program, where i say something
"" like
""
"" $var = "abc";
"" $aline = "xxxxabc!xxxx";
""
"" $aline =~ /${var}!/; #say this is like line 60
""
"" Sometimes when i try to run the above program, it complains of a syntax
"" error, occuring around line 100 or something. After debugging i find out
""
"" that my emacs editor doesn't like the brackets i use above for whatever
""
"" reason. So then *the only thing i change* is this one line 60, to say
"" $aline =~ /{$var}!/; and that syntax error is gone, and the program can
"" run. The things i don't get are (1) how my original syntax was wrong,
"" and (2) why it complains only on certain machines. I ran it on a Solaris
""
"" just fine without even a warning, but then on a Sun OS it wouldn't even
"" run!
*shrug* Neither /${var}!/ nor /{$var}!/ are syntax errors, although they
mean different things. Without knowing about line 100, I can't tell you
what's possibly wrong. And if your editor doesn't like what you are doing,
get a different one!
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 10 Aug 1999 07:19:26 +0200
From: "Mats Nygren" <mats.nygren@swipnet.se>
Subject: Cheap web site configuration to grow in
Message-Id: <3HOr3.5913$i%3.9258@nntpserver.swip.net>
We have a business idea but are not sure of the demand.
Would it be possible to use Linux, Apache, MSQL/MySQL and Perl to develop a
web server & application environment to grow in? That is to say - we would
start of with minimum investment but could later buy hardware to have this
platform support 2000 simultaneous users. Let's say he number of concurrent
queries would be 100.
The database might be 60 000 records but could be split if that has any
impact on performance.
What approximate price could the hardware configuration cost?
Are there reasons (security/speed of Perl/stability) to stay away from such
a platform and instead go for let's say Oracle on a NT/Unix? Does anyone
know an example of Perl, MSQL/MySQL being used to serve quite a number of
users?
------------------------------
Date: Tue, 10 Aug 1999 05:21:25 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: diff in perl?
Message-Id: <7oocr8$6bk$1@monet.op.net>
Keywords: befallen lovelorn revisable videotape
In article <7omsrh$j6q$1@nnrp1.deja.com>,
Jeremy Gurney <c4jgurney@my-deja.com> wrote:
>The Unix Reconstruction Project (http://language.perl.com/ppt/what.html)
>has a version of diff written in perl for portability.
>
>http://language.perl.com/ppt/src/diff/index.html
I should point out that this `diff' program is basically a wrapper
around the Algorithm::Diff module, which some people have already
pointed out is on CPAN.
The main web page for Algorithm::Diff, should you want more
information, is available at
http://www.plover.com/~mjd/perl/diff/
------------------------------
Date: 10 Aug 1999 05:22:54 GMT
From: Christopher Allen <callen@boxcar.driver8.org>
Subject: Re: How do I pass arguments from one CGI script to another?
Message-Id: <7oocve$2dn8$1@news1.spacestar.net>
Justin Development <mark.thomas@gsc.gte.com> wrote:
> I have an HTML file (my.html) that passes a username and password to a CGI
> script (let's call it my1.cgi), the my1.cgi script then passes name,
why don't you process this all in one script?
have your script do two things: retrieve info from html page,
process data(write to file , open a database whatever).
This would be more effecient.
-out
------------------------------
Date: 10 Aug 1999 05:36:24 GMT
From: goetz@cse.buffalo.edu (Phil Goetz)
Subject: Loading a web page
Message-Id: <7oodoo$gef$1@prometheus.acsu.buffalo.edu>
I know how to make an HTML file run a Perl script (using <FORM action=...>).
I know how to print out HTML from within a Perl CGI script.
But how do I get a Perl program to load a web page which
already exists as an HTML file, without requiring the user
to click on anything? (So printing out a <FORM action="myurl">
and waiting for the user to click on "submit" is not acceptable.)
Phil Goetz
flick@populus.net
------------------------------
Date: Tue, 10 Aug 1999 01:24:33 -0700
From: Michael Prendergast <mprender@virtualis.com>
Subject: Looking for a good Perl Book
Message-Id: <37AFE1C0.BF1239E5@virtualis.com>
Hello everyone,
I'm new to this forum, so none of you will probably recognise me.
I'm looking for a good Perl book to learn from. I do have programming
experience and I was wondering if any of you have a suggestion as to
which is a good book to introduce me to the Perl language. I'm not
*just* looking for an intro book though, I mean one with depth also, and
some assignments/quizzes also.
Plus, does anyone know of a good online school to learn Perl/Unix?
Preferably one with begginer and advanced Perl courses.
Thanks in advance,
Michael Prendergast
------------------------------
Date: 10 Aug 1999 01:22:15 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Looking for a good Perl Book
Message-Id: <x7r9lcb46w.fsf@home.sysarch.com>
>>>>> "MP" == Michael Prendergast <mprender@virtualis.com> writes:
MP> I'm looking for a good Perl book to learn from. I do have programming
MP> experience and I was wondering if any of you have a suggestion as to
MP> which is a good book to introduce me to the Perl language. I'm not
MP> *just* looking for an intro book though, I mean one with depth also, and
MP> some assignments/quizzes also.
if you are an experienced programmer, then "perl the programmer's
companion" is a good one. the bible of perl "programming perl" is a fine
reference and you could learn it from there too.
the online docs that come with perl are high quality and enormous (>1000
pages). they are the ultimate source of perl info. start reading them
now. when you finish, you will know perl.
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
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Mon, 9 Aug 1999 22:39:08 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Looking for a good Perl Book
Message-Id: <MPG.12195ad4d9fad7d98969c@nntp1.ba.best.com>
Uri Guttman (uri@sysarch.com) seems to say...
> the online docs that come with perl are high quality and enormous (>1000
> pages). they are the ultimate source of perl info. start reading them
> now. when you finish, you will know perl.
Perhaps for some. I just start reading at the beginning again.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Tue, 10 Aug 1999 01:51:17 -0700
From: Michael Prendergast <mprender@virtualis.com>
Subject: Re: Perl Question
Message-Id: <37AFE804.6025A8B1@virtualis.com>
Hi John,
This should be what you're looking for. In the line
print MAIL "From: John\n\n");
You have to have an actual email address in the "From" field otherwise
the server will place the server pop email address in the "From" field
instead of what you wrote. Try replacing the above line with
print MAIL "From: John <jsmith19991@my-deja.com>\n\n");
.... or whatever email address you want them to reply to. That should do
it.
In the program that the client receives the letter from the script, the
"From" field will still read "John" in the headers section (unless they
purposely want reveal your email address,) so don't worry about that.
You *have* to specify an email address in any email otherwise there is
no way for the recipient to reply to you - programming in Perl is no
different.
I hope this helps,
Michael Prendergast
jsmith19991@my-deja.com wrote:
> I'm having a problem with a Perl script that we
> wrote. The answer is probably a simple one and
> I would appreciate any helpful input. The problem
> we are having is with the E-mailing of information
> to a client. To make it simple, we have a script
> that sends an Email to someone when they enter
> their address. The script includes the following
> lines for sending the mail:
>
> ...
>
> open(MAIL,"|$mailprog -t");
>
> print MAIL "To: Mary Smith\n";
> print MAIL "From: John\n\n");
> print MAIL "Subject: Information\n\n";
>
> ...
>
> When the Email is received by the person however,
> the "From" field reads not "John" like we intend
> it to, but "John@whsun428.webhosting.com"
>
> How do we get rid of the extra server info
> following the name? We've tried a few things and
> it always reads the same.
>
> Jason
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
------------------------------
Date: 10 Aug 1999 00:26:20 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: perl script - help
Message-Id: <slrn7qvdvc.ahe.abigail@alexandra.delanet.com>
SAM/SMP (chris.martzloff@army.pentagon.mil) wrote on MMCLXIX September
MCMXCIII in <URL:news:%OFr3.2448$001.1198244@WReNphoon3>:
{} I'm new at programming - so if anyone could help.
{} I've got a big file with 4 columns or fields. The
{} two columns in the middle I don't care about. The
{} first column has a name or a string that doesn't
{} change nearly as much as the name or string in the
{} forth column. My objective is to count the number
{} of instances of the word, name or string in the forth
{} column to the name or string in the first column that
{} remains the same for a while and then it changes to a
{} different word for which I have to count over again.
{} I would like to print " for every one of these in the
{} first column I found 3 instances of that, 4 instances
{} of this and so on.
{}
{} In other words:
{}
{} tttt wecc eer 3/1
{} tttt fgds dfg 3/1
{} tttt fgds ghf 4/1
{} tttt dfgg rfc 4/1
{} rrrr dffs tgb 1/1
{} rrrr fdsg tgf 6/2
{}
{} for word tttt i found 2 instances of 3/1
{} 2 instances of 4/1.
{} for word rrrr i found 1 instance of 1/1 and 1 instance of 6/2.
perl -walne '$_{$F[0]}->{$F[3]}++;
END{map{print"For word $_ I found:";%_=%{$_{$_}};
map{print" $_{$_} instances of $_"}keys%_}keys%_}' file
Abigail
--
$" = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%_ = (Just => another => Perl => Hacker); &{%_};
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 10 Aug 1999 00:35:09 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: perl script - help
Message-Id: <slrn7qvefu.ahe.abigail@alexandra.delanet.com>
David Cassell (cassell@mail.cor.epa.gov) wrote on MMCLXIX September
MCMXCIII in <URL:news:37AF483F.A77DF578@mail.cor.epa.gov>:
{}
{} ($left, undef, undef, $right) = split; # note the undef's in here
Urg. What's wrong with:
($left, $right) = (split) [0,3];
{} foreach $left (sort keys %HoH) {
{} print "left col: $left\n";
{} foreach $right ( sort keys %{$HoH{$left}} ) {
{} print " count for $right is $HoH{$left}{$right}\n";
{} }
{} }
I'd write that as:
while (($left, $righthash) = each %HoH) {
print "left col: $left\n";
while (($right, $amount) = each %$righthash) {
print " count for $right is $amount\n";
}
}
Sure, you lose the sorting, but there was no indication sorting
was desirable.
Abigail
--
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 10 Aug 1999 00:37:04 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: pricing a perl job
Message-Id: <slrn7qveji.ahe.abigail@alexandra.delanet.com>
Max Pinton (max@maxgraphic.com) wrote on MMCLXX September MCMXCIII in
<URL:news:090819991743144695%max@maxgraphic.com>:
[]
[] Would I have gotten a real response if I had posed as a client looking
[] for a quote? Or has usenet simply ceased being a useful resource?
Whiner.
*ploink*
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
-> define ("foldoc", "perl")) [0] -> print'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 10 Aug 1999 00:38:43 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: print to file using here document
Message-Id: <slrn7qvemk.ahe.abigail@alexandra.delanet.com>
Jflowers44 (jflowers44@aol.com) wrote on MMCLXIX September MCMXCIII in
<URL:news:19990809194546.13367.00007603@ng-bd1.aol.com>:
[] I am trying to print to a file using the here document notation. I know that
[] the script works fine otherwise, but when I telnet into my web server (it's
[] cgi-script that writes to html files) and try to compile it with perl, it say
[] that it doesn't find the terminator (the thing that it's supposed to print to
[] untill it reads). The terminator has no spaces. can anyone help? Thanks.
There's a bug in line 17.
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 10 Aug 1999 00:41:07 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: print to file using here document
Message-Id: <slrn7qver4.ahe.abigail@alexandra.delanet.com>
Jflowers44 (jflowers44@aol.com) wrote on MMCLXX September MCMXCIII in
<URL:news:19990809210809.04810.00009744@ng-bk1.aol.com>:
** Here is the relevant code;
**
** open (LOG, $filename);
** print LOG << "(HTMLCODE)";
** <HTML> <HEAD> <TITLE> Hello </TITLE> </HEAD>\n;
** <BODY background = \"../backgrounds/$background\">;
** <FONT COLOR = \"$fontcolor\">;
** <H1> $heading </H1> <BR> $comments </FONT> </BODY> </HTML>;
** (HTMLCODE)
** close(LOG);
I don't believe you. You said it works fine otherwise, just not on
machine you telnet to. I see one huge bug, and very likely two.
The above fragment won't compile. Not on any Perl. Unless of course
there's a relevant piece of code you haven't told us about.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 10 Aug 1999 05:51:16 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: print to file using here document
Message-Id: <o5Pr3.5469$rR.12055@nsw.nnrp.telstra.net>
In article <19990809210809.04810.00009744@ng-bk1.aol.com>,
jflowers44@aol.com (Jflowers44) writes:
> Here is the relevant code;
>
> open (LOG, $filename);
You should check this.
> print LOG << "(HTMLCODE)";
You can't print to a file that you open for read.
# perldoc -f open
> <HTML> <HEAD> <TITLE> Hello </TITLE> </HEAD>\n;
Why the \n? The point of a here-doc is that you can just type what you
want to come out. And did you really want a ';' in your HTML?
> <BODY background = \"../backgrounds/$background\">;
Why the backslashes? Did you really intend the ';'?
> <FONT COLOR = \"$fontcolor\">;
> <H1> $heading </H1> <BR> $comments </FONT> </BODY> </HTML>;
> (HTMLCODE)
If you intended this to be the end of your here-doc, then you better
think again:
# perldoc perldata
/here-doc
# perldoc -q '<<' | grep head2
=head2 Why don't my <<HERE documents work?
Martien
--
Martien Verbruggen |
Interactive Media Division | Little girls, like butterflies, need no
Commercial Dynamics Pty. Ltd. | excuse - Lazarus Long
NSW, Australia |
------------------------------
Date: 10 Aug 1999 00:42:37 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Replace section in file with another file
Message-Id: <slrn7qvett.ahe.abigail@alexandra.delanet.com>
Chris L (fncll@uaf.edu) wrote on MMCLXIX September MCMXCIII in
<URL:news:7onlte$6q2$1@nnrp1.deja.com>:
;; I've searched the archives and read the fAQ (5)... and while I
;; understand how to replace a string in a file with another string, I'm
;; unclear how to replace a section in a file with the whole of another
;; file.
;;
;; My website has menus surrounded by comment tags:
;; <!--startmenu-->
;; foostuff
;; <!--endmenu-->
;;
;; I would like to replace that section with another section that resides
;; in a file...
What exactly don't you understand? You know about open and print, don't you?
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 10 Aug 1999 00:45:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Stopping someone from getting my cgi-scripts
Message-Id: <slrn7qvf3g.ahe.abigail@alexandra.delanet.com>
Zoraster (zorasterREMOVE@prontomail.com) wrote on MMCLXIX September
MCMXCIII in <URL:news:37af4145.14042984@news.jps.net>:
@@ A "friend" of mine is using some progrram or commands that allows
@@ him to view and copy all my cgi scripts off my website.
@@
@@ I have read about this is some perl books, but it didn't explain how
@@ he was doing it od how to stop it. Other than be careful
@@ in writing your scripts.
@@
@@ My question is how can I stop him and other ppl from grabbing my
@@ cgi-scripts
Hire a security expert. Security isn't something to be taken lightly.
And find better friends.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 10 Aug 1999 01:54:48 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: suggestions for CRAP
Message-Id: <x7lnbkb2on.fsf@home.sysarch.com>
why are all the free cgi sites full of crappy code? doesn't anyone who
knows how to use a module publish scripts on the web? is it a requirement
to have a site of free code to have a room temp iq?
here are some fun examples that pinyan's group can comment upon. some
general notes:
none use cgi.pm, strict or -w. they are both over and under commented at
the same time. all have multiline copyrights (as if anyone would want to
claim this crap as their own).
http://www.datacomm.ch/atair/perlscript/vote.pl
###Getting http-DATA.
@QueryArray=();
@QueryKey=();
%Query=();
why are these initialized and then assigned to?
$QueryString=$ENV{'QUERY_STRING'};
$client_addr=$ENV{'REMOTE_ADDR'};
$cookie_string=$ENV{'HTTP_COOKIE'};
@QueryArray=split '&',$QueryString;
foreach(@QueryArray){
($key, $val) = split ('=',$_);
$Query{$key} = $val;
}
@QueryKey=keys(%Query);
give that guy credit. this isn't cargo cult from matt. he rolled his own
crap cgi parser.
he uses lower case filehandles, but he does check for open errors. then
he does dumb stuff like:
if (!open(filehandle1,$config)) {printError("ERROR reading $config\n");}
while (<filehandle1>) {
push(@settings,$_);
}
slurping a whole file may be poor, but the while/push loop is pathetic.
http://bignosebird.com/carchive/survey/survey.txt
this one never checks for open errors but it has upper case file
handles.
my favorite part is grep_hunt:
sub grep_hunt
{
if ( -e "/bin/fgrep")
{$GREP="/bin/fgrep"; return;}
if ( -e "/bin/grep")
{$GREP="/bin/grep"; return;}
if ( -e "/usr/bin/grep")
{$GREP="/usr/bin/grep"; return;}
if ( -e "/sbin/fgrep")
{$GREP="/sbin/fgrep"; return;}
if ( -e "/usr/sbin/fgrep")
{$GREP="/usr/sbin/fgrep"; return;}
if ( -e "/usr/bin/fgrep")
{$GREP="/usr/bin/fgrep"; return;}
if ( -e "/usr/sbin/grep")
{$GREP="/usr/sbin/grep"; return;}
if ( -e "/sbin/grep")
{$GREP="/sbin/grep"; return;}
print "Content-type: text/html\n\n";
print "ERROR! Unable to find grep utility.\n";
does anyone see a potential loop there? besides it being a stupid thing to
do at runtime.
http://www.shavenferret.com/scripts/vote/download/vote.cgi
this has my favorite moron code, multiple print statements. why do
newbies never discover here docs? i also wonder why they think here docs
are for printing only? it should be documented or xref'ed from the
literal/quoting sections of the docs.
also it has lots of backwhacked quotes in quotes.
print "<center>Administration<form method=\"POST\"></center>\n";
print "<table cols=\"2\"><tr><td align=\"right\">Password:</td>\n";
print "<td><input type=\"password\" name=\"password\"></td></tr></table>\n";
here is a fun section. the open isn't checked but he does a clean slurp
of the file (which isn't needed). but then, he loops TWICE over the
lines and splits each line again. also he never learned about +=.
open (FILE, "$data_path/ch$FORM{'topic'}.txt");
@lines = <FILE>;
close(FILE);
$i = 0;
foreach $line(@lines) {
($topic,$votes,$num) = split(/\|/, $line);
$i = $i + $votes;
}
foreach $line(@lines) {
($topic,$votes,$num) = split(/\|/, $line);
if ($i > 0) { $percent = sprintf("%.2f",100 * ($votes / $i)); }
else { $percent = "NA"; }
}
oh, well, i am sick of this. does someone know of a decently written
free cgi script of any sort out there? let alone a repository of them? i
bet it is because all the decent perl hackers have plenty of real work
to do or they focus on cpan and the core rather than cgi apps.
maybe we should form a little project to create a web site with quality
cgi (and other) scripts. if tom can raise support for the power tools
project, this should be doable too. then we can finally direct folks to
examples of cgi code we can be proud of. this crap is embarrassing to
the perl community.
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
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Tue, 10 Aug 1999 13:05:51 +0800
From: "¶ÂȘL¶w" <stupid@people.comos>
Subject: Testing
Message-Id: <7oocih$5f2$1@justice.csc.cuhk.edu.hk>
Testing only
------------------------------
Date: Tue, 10 Aug 1999 05:53:11 GMT
From: "Dustin Hills" <discouts@home.com>
Subject: turn $6 into $6000
Message-Id: <b7Pr3.43903$B5.223156@news1.rdc1.bc.home.com>
------------------------------
Date: 10 Aug 1999 01:59:11 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: turn $6 into $6000
Message-Id: <x7iu6ob2hc.fsf@home.sysarch.com>
$money = '$6' ;
$money .= '000' ;
print $money ;
i have always wanted to print money.
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
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: 10 Aug 1999 00:46:59 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: UpperCase first letter of string only.
Message-Id: <slrn7qvf65.ahe.abigail@alexandra.delanet.com>
Bart Simpson (phony@nospam.com) wrote on MMCLXX September MCMXCIII in
<URL:news:7onqqe$qvv$0@216.39.133.155>:
;; my $mystring='hello';
;;
;; How would I go about changing $mystring so it contains 'Hello'? I have a
;; script where names are entered, and would like to make sure the first letter
;; is capitalized.
Perl has a buildin that does this for you, with an incredible trivial
interface. What part don't you understand?
Abigail
--
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print
qq{Just Another Perl Hacker\n}}}}}}}}}' |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 10 Aug 1999 00:47:46 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: User Authentication
Message-Id: <slrn7qvf7j.ahe.abigail@alexandra.delanet.com>
Matthew Porter (matthew.porter@wwt.com) wrote on MMCLXIX September
MCMXCIII in <URL:news:37AEFE22.84EE89B1@wwt.com>:
.. Does anyone know how to strip the username and password sumitted from an
.. authentication box? I need to do this in order to log the user into
.. other on-line systems. Any assistance would be greatly appreciated.
And your Perl question is?
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 10 Aug 1999 00:50:27 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: User Authentication
Message-Id: <slrn7qvfck.ahe.abigail@alexandra.delanet.com>
Matthew Porter (matthew.porter@wwt.com) wrote on MMCLXIX September
MCMXCIII in <URL:news:37AF3245.6657AA96@wwt.com>:
@@
@@ Any help would be appreciated.
You might get some help if you keep your lines short; although
the question is borderline when it comes to the topic of the
group. Don't hold your breath.
I certainly don't answer question that are improperly formatted.
Abigail
--
perl -wlpe '}{$_=$.' file # Count the number of lines.
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 V9 Issue 440
*************************************