[10233] in Perl-Users-Digest
Perl-Users Digest, Issue: 3826 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 25 17:07:21 1998
Date: Fri, 25 Sep 98 14:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 25 Sep 1998 Volume: 8 Number: 3826
Today's topics:
Re: any way to encrypt my script? fnantes@my-dejanews.com
capturing html to variable or file (Mike Burnett)
Re: cat reese > /dev/null (was Re: Perl & Java - differ <borg@imaginary.com>
Re: cat reese > /dev/null (was Re: Perl & Java - differ <borg@imaginary.com>
Re: cat reese > /dev/null (was Re: Perl & Java - differ <borg@imaginary.com>
Re: cat reese > /dev/null (was Re: Perl & Java - differ <zenin@bawdycaste.org>
Re: cat reese > /dev/null (was Re: Perl & Java - differ omnes@everywhere.org
Re: cat reese > /dev/null (was Re: Perl & Java - differ <uri@camel.fastserv.com>
Re: cat reese > /dev/null (was Re: Perl & Java - differ (Gary L. Burnore)
Re: cat reese > /dev/null (was Re: Perl & Java - differ <jdporter@min.net>
Re: cat reese > /dev/null (was Re: Perl & Java - differ <jdporter@min.net>
Re: cat reese > /dev/null (was Re: Perl & Java - differ (Gary L. Burnore)
Re: Coding Standards? <zenin@bawdycaste.org>
Re: exec cgi in apache 1.3.1 postmaster@truevision.net
help w/a script? <joe@anywhere.com>
Re: help w/a script? <uri@camel.fastserv.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 25 Sep 1998 19:51:42 GMT
From: fnantes@my-dejanews.com
Subject: Re: any way to encrypt my script?
Message-Id: <6ugs8f$lpk$1@nnrp1.dejanews.com>
In article <6tpoau$iqa$1@netnews.csie.NCTU.edu.tw>,
dennis@info4.csie.nctu.edu.tw (GEMINI) wrote:
> Using script has a lot of flexibility than compiled executable.
> However, if I don't want to show my source code
> to the world, what should I do with my script? Can
> I encrypt my script so that it can be executed but not read?
> thanks.
>
The FAQ:
ftp://ftp.uwsg.indiana.edu/pub/perl/CPAN/doc/manual/html/pod/perlfaq3.html
reads:
How can I hide the source for my Perl program?
Delete it. :-) Seriously, there are a number of (mostly unsatisfactory)
solutions with varying levels of ``security''.
First of all, however, you can't take away read permission, because the source
code has to be readable in order to be
compiled and interpreted. (That doesn't mean that a CGI script's source is
readable by people on the web, though, only by
people with access to the filesystem) So you have to leave the permissions at
the socially friendly 0755 level.
Some people regard this as a security problem. If your program does insecure
things, and relies on people not knowing how to exploit those insecurities,
it is not secure. It is often possible for someone to determine the insecure
things and exploit them without viewing the source. Security through
obscurity, the name for hiding your bugs instead of fixing them, is little
security indeed.
You can try using encryption via source filters (Filter::* from CPAN), but
crackers might be able to decrypt it. You can try using the byte code
compiler and interpreter described below, but crackers might be able to
de-compile it. You can try using the native-code compiler described below,
but crackers might be able to disassemble it. These pose varying degrees of
difficulty to people wanting to get at your code, but none can definitively
conceal it (this is true of every language, not just Perl).
If you're concerned about people profiting from your code, then the bottom
line is that nothing but a restrictive licence will give you legal security.
License your software and pepper it with threatening statements like ``This
is unpublished proprietary software of XYZ Corp. Your access to it does not
give you permission to use it blah blah blah.'' We are not lawyers, of
course, so you should see a lawyer if you want to be sure your licence's
wording will stand up in court. --- END FAQ ---
You see how a trip to the FAQ can save a LOT of bandwidth?
Take care,
-Fernando
--
Fernando N. De Souza
Oracle/UNIX Admin
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 25 Sep 1998 20:38:01 GMT
From: mnb@ornl.gov (Mike Burnett)
Subject: capturing html to variable or file
Message-Id: <6uguv9$vp4$1@sws1.ctd.ornl.gov>
I'm am using perl on a Windows NT Server.
Could someone please provide the perl code to do the following:
open a URL, but instead of displaying the web page, capture the
HTML code in a variable or file
Thanks.
Mike Burnett
mnb@ornl.gov
------------------------------
Date: Fri, 25 Sep 1998 19:07:10 GMT
From: George Reese <borg@imaginary.com>
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <yRRO1.2136$Ge.6836178@ptah.visi.com>
In comp.lang.java.programmer John Porter <jdporter@min.net> wrote:
: So you really mean: A "decade" is a good approximation of 7 years.
: 30%-43% error is not what I'd call a good approximation.
: In any case, a "decade" is a very poor approximation of 5 years.
: According to your resume, you first worked as a programmer in 1993.
: Your first attested programming experience (muds) was in late 1992.
: So I take it that by "a decade" you're just rounding 6 up to the
: nearest whole number of decades.
I have been programming for just shy of 8 years. You can play all
sort of games with numbers you like, but it won't change the facts.
--
George Reese (borg@imaginary.com) http://www.imaginary.com/~borg
PGP Key: http://www.imaginary.com/servlet/Finger?user=borg&verbose=yes
"Keep Ted Turner and his goddamned Crayolas away from my movie."
-Orson Welles
------------------------------
Date: Fri, 25 Sep 1998 19:14:36 GMT
From: George Reese <borg@imaginary.com>
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <wYRO1.2141$Ge.6836178@ptah.visi.com>
In comp.lang.java.programmer Uri Guttman <uri@camel.fastserv.com> wrote:
:>>>>> "GR" == George Reese <borg@imaginary.com> writes:
: GR> A "decade" is a good approximation of 8 years. And, yes, I was in
: GR> college in 1991.
: just shows how little you learned. was your college promoted by sally
: struthers? did you major in poor polemics? did they have a maximum SAT
: score for entry? who printed up your java certificate, yourself?
Excuse me? You don't know a damn thing about me. The school I went
to is one of the top colleges in the nation. My guess is almost none
of the people reading this thread could have gotten in.
: do you actually realize you are dealing with adults who majored in
: computer science, who have more than one partial decade of experience,
: who have published articles, books, gotten patents, designed large
: systems and one liners, etc., etc.
Computer science majors are 100% irrelevant. While I do have 6 years of
professional programming experience and 8 years of overall programming
experience, # of years of experience is actually a very poor guide to
what someone knows.
And I have been published in several magazines. I have written one
full book and contributed chapters to a half dozen others. I do
speaking engagements all over the world and I have designed and
implemented several very large systems.
So, what is your point?
: so where do you come off with your twisted non-logic, unsupported
: claims, and telling us what is the right way to do anything in any field
: (let alone computers).
Because you need serious help any way you can get it.
: it must take a strong character to make hundreds of enemies (who must
: all be wrong), and stand up so tall and proud. in twelve angry men
: henry, fonda did it. you are no henry fonda!
Hundreds of enemies? Try a few idiot programmers who work in a
language that I do not value.
--
George Reese (borg@imaginary.com) http://www.imaginary.com/~borg
PGP Key: http://www.imaginary.com/servlet/Finger?user=borg&verbose=yes
"Keep Ted Turner and his goddamned Crayolas away from my movie."
-Orson Welles
------------------------------
Date: Fri, 25 Sep 1998 19:08:51 GMT
From: George Reese <borg@imaginary.com>
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <7TRO1.2138$Ge.6836178@ptah.visi.com>
In comp.lang.java.programmer Zenin <zenin@bawdycaste.org> wrote:
: George Reese <borg@imaginary.com> wrote:
: : In comp.lang.java.programmer John Klassa <klassa@aur.alcatel.com> wrote:
: : : On Tue, 22 Sep 1998 13:47:48 GMT, George Reese <borg@imaginary.com> wrote:
: : : > Ahh, yes, let's all be judged by the code we wrote a decade ago in
: : : > college.
: : : You didn't write code a decade ago, in college. You didn't write code a
: : : decade ago, period. You didn't write code until at least 1991, according
: : : to your web page
: >snip<
: : A "decade" is a good approximation of 8 years.
: This is why the English language has qualifiers like "nearly".
: Please feel free to use as many as you feel you need to express
: yourself clearly. You have no right to get upset with anyone
: if you are simply to lazy to state yourself clearly, however
: if the problem stems from a lack of background in the English
: language I'm sure the readers here can recommend a few good
: texts that may help.
: If you sold something that was marked $8, would you ask the buyer
: for $10 because it "is a good approximation of 8"?
It depends if I were quoting a price or giving an approximation. In
the case above, the exact number of years was wholly irrelevant. It
was the fact that all she has ever seen is the first piece of code I
wrote.
You guys are really sad and pathetic as to how desperate you are to
put me down.
--
George Reese (borg@imaginary.com) http://www.imaginary.com/~borg
PGP Key: http://www.imaginary.com/servlet/Finger?user=borg&verbose=yes
"Keep Ted Turner and his goddamned Crayolas away from my movie."
-Orson Welles
------------------------------
Date: 25 Sep 1998 19:49:14 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <906752865.441150@thrush.omix.com>
George Reese <borg@imaginary.com> wrote:
>snip<
: It depends if I were quoting a price or giving an approximation.
You where doing neither. You where making a declaration
of fact. Only later did you revise your statement to call
it an approximation, which was later shown to simply be
a round up and not an approximation at all.
: You guys are really sad and pathetic as to how desperate you are to
: put me down.
Why should we waste our time putting you down, when others have
already done it so well in the past:
"When it comes to technical merit your arguments have all the
usefulness of a potted plant."
-- Dean Schulze to George Reese in <335AA784.5DD8@lpl.arizona.edu>
--
-Zenin (zenin@archive.rhps.org)
"Never try to teach a pig to sing,
it makes one look stupid
and it irritates the pig."
-- Unknown, but I think George may have been a pig in a past life
------------------------------
Date: 25 Sep 1998 19:37:01 GMT
From: omnes@everywhere.org
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <6ugrct$bga12@eccws1.dearborn.ford.com>
In article <wYRO1.2141$Ge.6836178@ptah.visi.com>,
George Reese <borg@imaginary.com> writes:
>In comp.lang.java.programmer Uri Guttman <uri@camel.fastserv.com> wrote:
>Excuse me? You don't know a damn thing about me. The school I went
>to is one of the top colleges in the nation. My guess is almost none
>of the people reading this thread could have gotten in.
# # ##### # #### # # # # # #
# # # # # # # ## # # # # #
####### # # # # # # # # #### #######
# # ##### # # # # # # # # # #
# # # # # # # ## # # # #
# ###### #### # # # #
------------------------------
Date: 25 Sep 1998 16:11:31 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <sard88kvtos.fsf@camel.fastserv.com>
>>>>> "GR" == George Reese <borg@imaginary.com> writes:
GR> In comp.lang.java.programmer Uri Guttman <uri@camel.fastserv.com>
GR> wrote: :>>>>> "GR" == George Reese <borg@imaginary.com> writes:
GR> : GR> A "decade" is a good approximation of 8 years. And, yes, I
GR> was in : GR> college in 1991.
GR> : just shows how little you learned. was your college promoted by
GR> sally : struthers? did you major in poor polemics? did they have a
GR> maximum SAT : score for entry? who printed up your java
GR> certificate, yourself?
GR> Excuse me? You don't know a damn thing about me. The school I
GR> went to is one of the top colleges in the nation. My guess is
GR> almost none of the people reading this thread could have gotten
GR> in.
but you didn't study any computer science there which make a big difference.
GR> Computer science majors are 100% irrelevant. While I do have 6
GR> years of professional programming experience and 8 years of
GR> overall programming experience, # of years of experience is
GR> actually a very poor guide to what someone knows.
oh boy, i have 24 years of programming, a degree in CS from a school
that wouldn't accept you as a janitor (but they did accept will
hunting), developed on many platforms in many languages, etc. etc.
the point is that you have a very narrow background and you claim to
understand computer science.
GR> And I have been published in several magazines. I have written
GR> one full book and contributed chapters to a half dozen others. I
GR> do speaking engagements all over the world and I have designed and
GR> implemented several very large systems.
all in java? what about C, assembly, compilers, cross platforms, realtime,
protocols, kernels, device drivers, run time libraries, etc. have you
ever done anything but java? if not, that makes you no expert in
computer science.
GR> : so where do you come off with your twisted non-logic,
GR> unsupported : claims, and telling us what is the right way to do
GR> anything in any field : (let alone computers).
GR> Because you need serious help any way you can get it.
oooooh, i need medical attention now. can someone help me? my heart just
stopped from the force of georgies invective.
GR> Hundreds of enemies? Try a few idiot programmers who work in a
GR> language that I do not value.
coming from someone whose opinion is valued by no one on this (and
from what i hear several other) newsgroups. you have a reputation for being a
solo flame artist vs. hordes of education computer folks. your insults
mean very little as you carry no weight on the net.
stick to your provincial java world and group and stay out of the perl
world. the stink you emit is upsetting my stomach. it doesn't matter
which language is better, but knowing that you side with java makes me
feel fine about perl. i would hate to have you on our side.
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Fri, 25 Sep 1998 20:52:59 GMT
From: gburnore@databasix.com (Gary L. Burnore)
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <360d028c.74132581@nntpd.databasix.com>
On Fri, 25 Sep 1998 19:14:36 GMT, in article
<wYRO1.2141$Ge.6836178@ptah.visi.com>, George Reese <borg@imaginary.com>
wrote:
>In comp.lang.java.programmer Uri Guttman <uri@camel.fastserv.com> wrote:
>:>>>>> "GR" == George Reese <borg@imaginary.com> writes:
>
>
>: GR> A "decade" is a good approximation of 8 years. And, yes, I was in
>: GR> college in 1991.
>
>: just shows how little you learned. was your college promoted by sally
>: struthers? did you major in poor polemics? did they have a maximum SAT
>: score for entry? who printed up your java certificate, yourself?
>
>Excuse me? You don't know a damn thing about me. The school I went
>to is one of the top colleges in the nation. My guess is almost none
>of the people reading this thread could have gotten in.
Kmart school of science?
--
I DO NOT WISH TO RECEIVE EMAIL IN REGARD TO USENET POSTS
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
| ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
DOH! | ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
| ][3 3 4 1 4 2 ]3^3 6 9 0 6 9 ][3
Special Sig for perl groups. | Official Proof of Purchase
===========================================================================
------------------------------
Date: Fri, 25 Sep 1998 17:00:51 -0400
From: John Porter <jdporter@min.net>
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <360C0483.E367DB52@min.net>
George Reese wrote:
>
> I have been programming for just shy of 8 years. You can play all
> sort of games with numbers you like, but it won't change the facts.
With all due respect, Georgie boy, you're the one playing games
with numbers. Saying 8 is 10. For crying out loud.
And saying you've been programming for 10 years when it's been about
8 (or more likely 7), is serious. You're looking to inflate yourself
by any means possible. But Oh, no, you're credibility's not damaged!
Not at all!
--
John "Many Jars" Porter
------------------------------
Date: Fri, 25 Sep 1998 17:01:55 -0400
From: John Porter <jdporter@min.net>
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <360C04C3.121F3C4E@min.net>
George Reese wrote:
>
> You guys are really sad and pathetic as to how desperate you are to
> put me down.
Far less sad, and far less pathetic, than this guy who is trying so
hard to put himself up.
--
John "Many Jars" Porter
------------------------------
Date: Fri, 25 Sep 1998 20:57:53 GMT
From: gburnore@databasix.com (Gary L. Burnore)
Subject: Re: cat reese > /dev/null (was Re: Perl & Java - differences and uses)
Message-Id: <360e03b7.74431557@nntpd.databasix.com>
On Fri, 25 Sep 1998 19:08:51 GMT, in article
<7TRO1.2138$Ge.6836178@ptah.visi.com>, George Reese <borg@imaginary.com>
wrote:
>You guys are really sad and pathetic as to how desperate you are to
>put me down.
Why would anyone want to try to do what you already do so well all by
yourself?
--
I DO NOT WISH TO RECEIVE EMAIL IN REGARD TO USENET POSTS
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
| ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
DOH! | ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
| ][3 3 4 1 4 2 ]3^3 6 9 0 6 9 ][3
Special Sig for perl groups. | Official Proof of Purchase
===========================================================================
------------------------------
Date: 25 Sep 1998 20:10:25 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Coding Standards?
Message-Id: <906754113.407068@thrush.omix.com>
[posted & mailed]
Lee Mulleady <lemull@unx.sas.com> wrote:
: Can anyone point me to a set of Coding Standards developed
: specifically for Perl?
man perlstyle
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: Fri, 25 Sep 1998 20:31:29 GMT
From: postmaster@truevision.net
Subject: Re: exec cgi in apache 1.3.1
Message-Id: <6uguj1$o17$1@nnrp1.dejanews.com>
rbbloom@us.ibm.com (Ryan Bloom) wrote:
> In article <6ug89s$ji$1@nnrp1.dejanews.com>, postmaster@truevision.net
> The SSI code you posted originally referenced was:
>
> <!--#exec cgi="/cgi-bin/counter.pl"-->
>
> Two issues. 1) Unless you have either an Alias, AliasMatch, or
> ScriptAlias directive to tell Apache that /cgi-bin/ maps to
> /the/proper/location, this won't work, because Apache doesn't know where
> to find the file. You haven't included any of those directives, so I am
> assuming you don't have one. 2) the --> at the end of the SSI command
> MUST have a space before it. Without it, it is not a valid SSI command,
> refer the docs on mod_include that come with Apache, or SSI RFC.
I have a ScriptAlias directive to tell that /cgi-bin/ maps to the proper
directory. And, my entry <!--#exec cgi="..." --> have a space in the .html
file.
> Lastly, please tell us what your error_log says. I have a feeling the
> problem will be either file not found, in which case, look at the
> preceding paragraph.
>
I don't have errors logs in the apache logs files.
Regards.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 25 Sep 1998 14:20:10 -0500
From: "Sean" <joe@anywhere.com>
Subject: help w/a script?
Message-Id: <360bed19.0@130.160.4.249>
I guess this is a perl script but maybe some kind intellectual soul has time
to help look at my script and see what may be wrong. Any help would be
greatly appreciated. By the way, this is a guestbook script!
Thanks for any time you may have!
Sean
DELETECAPSseanb@writeme.com
#!/usr/local/bin/perl
$GuestLoc = "/st1/blank005/public_html/guestbook.html";
$MailTo = "seanb\@writeme.com";
$MailProg = "/usr/lib/sendmail";
############################################################################
#####
$DateCommand = "/usr/bin/date";
$Date = `$DateCommand +"%B %d, %Y"`;
chop($Date);
############################################################################
#####
&ReadParse;
############################################################################
#####
#open 'guestbook.html' for input
open (TheFile,"$GuestLoc") || die "Can't Open $GuestLoc: $!\n";
@LINES = <TheFile>;
close (TheFile);
$SIZE = @LINES;
############################################################################
#####
#Open link file to Output
open (Guest,">$GuestLoc") || die "Can't Open $GuestLoc: $!\n";
for ($i=0;$i<=$SIZE;$i++) {
$_ = $LINES[$i];
if (/<!--add-->/) {
print Guest "<!--add-->\n";
print Guest "<table cellpadding=0 cellspacing=1 border=0>\n";
print Guest "<tr><td><b>Name:</b></td><td>$in{'name'}$date</td></tr>\n";
print Guest "<tr><td><b>E-mail:</b></td><td><a
href=\"mailto:$in{'email'}\"> $in{'email'}</a></td></tr>\n";
print Guest "<tr><td><b>My Url:</b></td><td><a
href=$in{'url'}>$in{'url'}</a></td></tr>\n";
print Guest "<tr><td><b>Location:</b></td><td>$in{'city'}";
print Guest ", $in{'state'}
$in{'country'}</td></tr>\n";
print Guest "<tr><td valign=top><b>Comments:</b></td>\n";
print Guest "<td>$in{'comments'}</td></tr></table><p>\n";
}
else {
print Guest $_;
}
}
close (Guest);
############################################################################
#####
# SubRoutines
#
############################################################################
#####
sub ReadParse {
local (*in) = shift if @_;
local (*incfn,
*inct,
*insfn) = @_;
local ($len, $type, $meth, $errflag, $cmdflag, $perlwarn, $got, $name);
$perlwarn = $^W;
$^W = 0;
binmode(STDIN);
binmode(STDOUT);
binmode(STDERR);
$type = $ENV{'CONTENT_TYPE'};
$len = $ENV{'CONTENT_LENGTH'};
$meth = $ENV{'REQUEST_METHOD'};
if ($len > $cgi_lib'maxdata) { #'
&CgiDie("cgi-lib.pl: Request to receive too much data: $len bytes\n");
}
if (!defined $meth || $meth eq '' || $meth eq 'GET' ||
$meth eq 'HEAD' ||
$type eq 'application/x-www-form-urlencoded') {
local ($key, $val, $i);
if (!defined $meth || $meth eq '') {
$in = $ENV{'QUERY_STRING'};
$cmdflag = 1; # also use command-line options
} elsif($meth eq 'GET' || $meth eq 'HEAD') {
$in = $ENV{'QUERY_STRING'};
} elsif ($meth eq 'POST') {
if (($got = read(STDIN, $in, $len) != $len))
{$errflag="Short Read: wanted $len, got $got\n";};
} else {
&CgiDie("cgi-lib.pl: Unknown request method: $meth\n");
}
@in = split(/[&;]/,$in);
push(@in, @ARGV) if $cmdflag;
foreach $i (0 .. $#in) {
$in[$i] =~ s/\+/ /g;
($key, $val) = split(/=/,$in[$i],2); # splits on the first =.
$key =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
$val =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
$in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple
separator
$in{$key} .= $val;
}
} elsif ($ENV{'CONTENT_TYPE'} =~ m#^multipart/form-data#) {
$errflag = !(eval <<'END_MULTIPART');
local ($buf, $boundary, $head, @heads, $cd, $ct, $fname, $ctype, $blen);
local ($bpos, $lpos, $left, $amt, $fn, $ser);
local ($bufsize, $maxbound, $writefiles) =
($cgi_lib'bufsize, $cgi_lib'maxbound, $cgi_lib'writefiles);
$buf = '';
($boundary) = $type =~ /boundary="([^"]+)"/; #";
($boundary) = $type =~ /boundary=(\S+)/ unless $boundary;
&CgiDie ("Boundary not provided: probably a bug in your server")
unless $boundary;
$boundary = "--" . $boundary;
$blen = length ($boundary);
if ($ENV{'REQUEST_METHOD'} ne 'POST') {
&CgiDie("Invalid request method for multipart/form-data: $meth\n");
}
if ($writefiles) {
local($me);
stat ($writefiles);
$writefiles = "/tmp" unless -d _ && -w _;
# ($me) = $0 =~ m#([^/]*)$#;
$writefiles .= "/$cgi_lib'filepre";
}
$left = $len;
PART:
while (1) {
die $@ if $errflag;
$amt = ($left > $bufsize+$maxbound-length($buf)
? $bufsize+$maxbound-length($buf): $left);
$errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
die "Short Read: wanted $amt, got $got\n" if $errflag;
$left -= $amt;
$in{$name} .= "\0" if defined $in{$name};
$in{$name} .= $fn if $fn;
$name=~/([-\w]+)/;
if (defined $1) {
$insfn{$1} .= "\0" if defined $insfn{$1};
$insfn{$1} .= $fn if $fn;
}
BODY:
while (($bpos = index($buf, $boundary)) == -1) {
if ($left == 0 && $buf eq '') {
foreach $value (values %insfn) {
unlink(split("\0",$value));
}
&CgiDie("cgi-lib.pl: reached end of input while seeking boundary " .
"of multipart. Format of CGI input is wrong.\n");
}
die $@ if $errflag;
if ($name) { # if no $name, then it's the prologue -- discard
if ($fn) { print FILE substr($buf, 0, $bufsize); }
else { $in{$name} .= substr($buf, 0, $bufsize); }
}
$buf = substr($buf, $bufsize);
$amt = ($left > $bufsize ? $bufsize : $left);
#$maxbound==length($buf);
$errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
die "Short Read: wanted $amt, got $got\n" if $errflag;
$left -= $amt;
}
if (defined $name) {
if ($fn) { print FILE substr($buf, 0, $bpos-2); }
else { $in {$name} .= substr($buf, 0, $bpos-2); } # kill last
\r\n
}
close (FILE);
last PART if substr($buf, $bpos + $blen, 2) eq "--";
substr($buf, 0, $bpos+$blen+2) = '';
$amt = ($left > $bufsize+$maxbound-length($buf)
? $bufsize+$maxbound-length($buf) : $left);
$errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
die "Short Read: wanted $amt, got $got\n" if $errflag;
$left -= $amt;
undef $head; undef $fn;
HEAD:
while (($lpos = index($buf, "\r\n\r\n")) == -1)
if ($left == 0 && $buf eq '') {
foreach $value (values %insfn) {
unlink(split("\0",$value));
}
&CgiDie("cgi-lib: reached end of input while seeking end of " .
"headers. Format of CGI input is wrong.\n$buf");
}
die $@ if $errflag;
$head .= substr($buf, 0, $bufsize);
$buf = substr($buf, $bufsize);
$amt = ($left > $bufsize ? $bufsize : $left);
#$maxbound==length($buf);
$errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt);
die "Short Read: wanted $amt, got $got\n" if $errflag;
$left -= $amt;
}
$head .= substr($buf, 0, $lpos+2);
push (@in, $head);
@heads = split("\r\n", $head);
($cd) = grep (/^\s*Content-Disposition:/i, @heads);
($ct) = grep (/^\s*Content-Type:/i, @heads);
($name) = $cd =~ /\bname="([^"]+)"/i; #";
($name) = $cd =~ /\bname=([^\s:;]+)/i unless defined $name;
($fname) = $cd =~ /\bfilename="([^"]*)"/i; #"; # filename can be
null-str
($fname) = $cd =~ /\bfilename=([^\s:;]+)/i unless defined $fname;
$incfn{$name} .= (defined $in{$name} ? "\0" : "") .
(defined $fname ? $fname : "");
($ctype) = $ct =~ /^\s*Content-type:\s*"([^"]+)"/i; #";
($ctype) = $ct =~ /^\s*Content-Type:\s*([^\s:;]+)/i unless defined
$ctype;
$inct{$name} .= (defined $in{$name} ? "\0" : "") . $ctype;
if ($writefiles && defined $fname) {
$ser++;
$fn = $writefiles . ".$$.$ser";
open (FILE, ">$fn") || &CgiDie("Couldn't open $fn\n");
binmode (FILE); # write files accurately
}
substr($buf, 0, $lpos+4) = '';
undef $fname;
undef $ctype;
}
1;
END_MULTIPART
if ($errflag) {
local ($errmsg, $value);
$errmsg = $@ || $errflag;
foreach $value (values %insfn) {
unlink(split("\0",$value));
}
&CgiDie($errmsg);
} else {
# everything's ok.
}
} else {
&CgiDie("cgi-lib.pl: Unknown Content-type: $ENV{'CONTENT_TYPE'}\n");
}
$insfn = $insfn;
$incfn = $incfn;
$inct = $inct;
$^W = $perlwarn;
return ($errflag ? undef : scalar(@in));
}
############################################################################
#####
############################################################################
#####
############################################################################
#####
------------------------------
Date: 25 Sep 1998 16:30:01 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: help w/a script?
Message-Id: <saraf3ovsty.fsf@camel.fastserv.com>
>>>>> "S" == Sean <joe@anywhere.com> writes:
S> I guess this is a perl script but maybe some kind intellectual soul
S> has time to help look at my script and see what may be wrong. Any
S> help would be greatly appreciated. By the way, this is a guestbook
S> script! Thanks for any time you may have! Sean
S> DELETECAPSseanb@writeme.com
yes it is a perl script.
it would help if you stated what you think is wrong or what doesn't
work.
if it works then it is fine for your purposes. are you looking for ways
to improve your working code? style? efficiency? code size? what do you
want?
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3826
**************************************