[24659] in Perl-Users-Digest
Perl-Users Digest, Issue: 6823 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 3 14:22:04 2004
Date: Tue, 3 Aug 2004 11:21:26 -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 Tue, 3 Aug 2004 Volume: 10 Number: 6823
Today's topics:
search/replace values from an array... <mr@sandman.net>
Re: search/replace values from an array... <j@j.com>
Re: search/replace values from an array... (Anno Siegel)
Re: search/replace values from an array... <matthew.garrish@sympatico.ca>
Re: search/replace values from an array... <mritty@gmail.com>
Re: search/replace values from an array... <jgibson@mail.arc.nasa.gov>
sed /5/d with as little blabbage <jidanni@jidanni.org>
Re: sed /5/d with as little blabbage (Anno Siegel)
Re: sed /5/d with as little blabbage <abigail@abigail.nl>
Re: sed /5/d with as little blabbage <rwxr-xr-x@gmx.de>
Re: sed /5/d with as little blabbage <uri@stemsystems.com>
Re: sed /5/d with as little blabbage <bik.mido@tiscalinet.it>
Re: sed /5/d with as little blabbage <bik.mido@tiscalinet.it>
Re: Self help change UNIX password through broswer - Ho <nobull@mail.com>
Re: Self help change UNIX password through broswer - Ho <bik.mido@tiscalinet.it>
Re: Self help change UNIX password through broswer - Ho <nobull@mail.com>
Re: SOLUTION IDENTIFIED Re: Parsing form POST without C <flavell@ph.gla.ac.uk>
Re: SOLUTION IDENTIFIED Re: Parsing form POST without C <noreply@gunnar.cc>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 01 Aug 2004 18:29:15 +0200
From: Sandman <mr@sandman.net>
Subject: search/replace values from an array...
Message-Id: <mr-3CA454.18291501082004@individual.net>
Ok, so here is a snippet that shows what I want to do:
#!/usr/bin/perl
use strict;
use warnings;
my $string = "Hello World!";
my %array = (
"Hello (.*?)!", "Goodbye, little #1#!"
# search replace
);
foreach (keys %array){
if ($string=~m/$_/i){
# It matched!
$array{$_}=~s/#(\d+)#/$$1/;
# replace #1# with $1, #2# with $2...
$string=~s/$_/$array{$_}/g;
# replace the string;
}
}
print $string;
The wanted result is "Goodbye, little World!", fetching "World" from $1 of the
match 4 lines up, but the error message is
File "test.pl"; Line 14: Can't use string ("1") as a SCALAR ref
while "strict refs" in use
So how do I solve it?
--
Sandman[.net]
------------------------------
Date: Sun, 1 Aug 2004 11:23:13 -0700
From: "nyana" <j@j.com>
Subject: Re: search/replace values from an array...
Message-Id: <8yaPc.27887$mg6.18729@fed1read02>
I thought scalars that started with a number had to take numbers. Is your
scalar taking text? Then it should start with a letter.
"Variable names that begin with a digit can contain only digits, and
variable names that begin with a character other than an alphanumeric or
underscore can contain only that character." -- Perl in a Nutshell,
Patwardwan et al.
"Sandman" <mr@sandman.net> wrote in message
news:mr-3CA454.18291501082004@individual.net...
> Ok, so here is a snippet that shows what I want to do:
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> my $string = "Hello World!";
>
> my %array = (
> "Hello (.*?)!", "Goodbye, little #1#!"
> # search replace
> );
> foreach (keys %array){
> if ($string=~m/$_/i){
> # It matched!
> $array{$_}=~s/#(\d+)#/$$1/;
> # replace #1# with $1, #2# with $2...
> $string=~s/$_/$array{$_}/g;
> # replace the string;
> }
> }
>
> print $string;
>
>
>
> The wanted result is "Goodbye, little World!", fetching "World" from $1 of
the
> match 4 lines up, but the error message is
>
> File "test.pl"; Line 14: Can't use string ("1") as a SCALAR ref
> while "strict refs" in use
>
> So how do I solve it?
>
> --
> Sandman[.net]
------------------------------
Date: 1 Aug 2004 18:40:44 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: search/replace values from an array...
Message-Id: <cejdfc$3s1$1@mamenchi.zrz.TU-Berlin.DE>
Sandman <mr@sandman.net> wrote in comp.lang.perl.misc:
> Ok, so here is a snippet that shows what I want to do:
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> my $string = "Hello World!";
>
> my %array = (
> "Hello (.*?)!", "Goodbye, little #1#!"
> # search replace
> );
> foreach (keys %array){
> if ($string=~m/$_/i){
> # It matched!
> $array{$_}=~s/#(\d+)#/$$1/;
^^
Is this line 14? "$$1" is a scalar dereference that would fail with
something like your message below.
Also, you're changing the association of pattern and replacement in %array
here. That is not something you want to do, except if you plan to
use %array only once.
> # replace #1# with $1, #2# with $2...
> $string=~s/$_/$array{$_}/g;
> # replace the string;
> }
> }
>
> print $string;
>
>
>
> The wanted result is "Goodbye, little World!", fetching "World" from $1 of the
> match 4 lines up, but the error message is
>
> File "test.pl"; Line 14: Can't use string ("1") as a SCALAR ref
> while "strict refs" in use
>
> So how do I solve it?
Here is one way. When you check each regex, build the replacement string
from the subpatterns that are captured by the regex. You do this by
(globally) replacing the markers "#1#", "#2#", etc. with the corresponding
submatch. The replacement string is now ready to use in a simple
substitution. For instance:
my %tab = (
'Hello (.*?)!' => 'Goodbye, little #1#...',
'Welcome (.*?) and (.*?)!' => 'Farewell, honorable #2# and fair #1#!',
);
for ( "Welcome ladies and gentlemen!", "Hello World!" ) {
my $string = $_; # make a copy we can change
while ( my ( $search, $replace) = each %tab ) {
# build ready-to-use replacement string from template
my $n = 1; # submatch number
for ( $string =~ /$search/ ) { # loop over submatches
$replace =~ s/#$n#/$_/g, # substitute one submatch everywhere
$n ++; # next submatch
}
last if $string =~ s/$search/$replace/;
}
print "$string\n";
}
The "last" in the while-loop ensures that at most one replacement is
done. Since you are using a hash, the replacements are tried in a random
sequence. It wouldn't make sense to try re-replacement on an already
processed string unless you control the order of the tries.
Anno
------------------------------
Date: Mon, 2 Aug 2004 12:21:14 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: search/replace values from an array...
Message-Id: <SRtPc.19627$Vm1.247557@news20.bellglobal.com>
"nyana" <j@j.com> wrote in message news:8yaPc.27887$mg6.18729@fed1read02...
> I thought scalars that started with a number had to take numbers. Is your
> scalar taking text? Then it should start with a letter.
>
> "Variable names that begin with a digit can contain only digits, and
> variable names that begin with a character other than an alphanumeric or
> underscore can contain only that character." -- Perl in a Nutshell,
> Patwardwan et al.
>
I have to believe you've taken that completely out of context. Not having
the book, I refer you to the perldata perldoc:
<quote>
Names that start with a digit may contain only more digits. Names that do
not start with a letter, underscore, digit or a caret (i.e. a control
character) are limited to one character, e.g., $% or $$. (Most of these one
character names have a predefined significance to Perl. For instance, $$ is
the current process id.)
</quote>
The variables $1, $2 ... are special match variables (i.e., they contain the
text matched by a regex). You cannot create variable names that begin with a
digit for this reason, and variables that begin with a digit can only
contain more digits (for example, $4323 would contain the text matched in
the four-thousand-three-hundered-and-twenty-third set of parens, regardless
of how hideous a regex that might be : ). You seem to be mistaking Perl for
a strongly typed language, which it's not. $1 can contain the string 'Hello
World' just as easily as $var can contain the numeric value 12.
I would suggest you reread the perldocs, starting with perldata and moving
on to perlre and perlvar.
Matt
------------------------------
Date: Mon, 2 Aug 2004 12:57:19 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: search/replace values from an array...
Message-Id: <20040802125519.K14831@barbara.cs.rpi.edu>
On Sun, 1 Aug 2004, nyana wrote:
> I thought scalars that started with a number had to take numbers. Is your
> scalar taking text? Then it should start with a letter.
>
> "Variable names that begin with a digit can contain only digits, and
> variable names that begin with a character other than an alphanumeric or
> underscore can contain only that character." -- Perl in a Nutshell,
> Patwardwan et al.
You've misparsed this paragraph. It does not say that variables whose
names start with digits can contain only digits, etc. It says that
variable NAMES that start with digits can contain only digits. The
contents of the variable has nothing at all to do with the name of the
variable.
Paul Lalli
------------------------------
Date: Mon, 02 Aug 2004 13:26:45 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: search/replace values from an array...
Message-Id: <020820041326456159%jgibson@mail.arc.nasa.gov>
In article <20040802125519.K14831@barbara.cs.rpi.edu>, Paul Lalli
<mritty@gmail.com> wrote:
> On Sun, 1 Aug 2004, nyana wrote:
>
> > I thought scalars that started with a number had to take numbers. Is your
> > scalar taking text? Then it should start with a letter.
> >
> > "Variable names that begin with a digit can contain only digits, and
> > variable names that begin with a character other than an alphanumeric or
> > underscore can contain only that character." -- Perl in a Nutshell,
> > Patwardwan et al.
>
> You've misparsed this paragraph. It does not say that variables whose
> names start with digits can contain only digits, etc. It says that
> variable NAMES that start with digits can contain only digits. The
> contents of the variable has nothing at all to do with the name of the
> variable.
This reminded me of a passage from "Alice in Wonderland", by Lewis
Caroll (see http://greatsfandf.com/AUTHORS/LewisCarroll.shtml for the
analogy to computer variables):
Then there is the passage in which the White Knight proposes to comfort
Alice by singing her a song:
"Is it very long?" Alice asked, for she had heard a good deal of
poetry that day.
"It's long," said the Knight, "but it's very, very beautiful.
Everybody that hears me sing it--either it brings the tears into their
eyes, or else--"
"Or else what?" said Alice, for the Knight had made a sudden pause.
"Or else it doesn't, you know. The name of the song is called
'Haddock's Eyes' ."
"Oh, that's the name of the song, is it?" Alice said, trying to feel
interested.
"No, you don't understand," the Knight said, looking a little vexed.
"That's what the name is called . The name really is 'The Aged Aged
Man' ."
"Then I ought to have said 'That's what the song is called?'" Alice
corrected herself.
"No, you oughtn't: that's quite another thing! The song is called
'Ways and Means' : but that's only what it's called , you know!"
"Well, what is the song, then?" said Alice, who was by this time
completely bewildered.
"I was coming to that," the Knight said. "The song really is
'A-sitting on a Gate' : and the tune's my own invention."
Sorry if I have wasted your time and bandwidth :)
------------------------------
Date: Tue, 27 Jul 2004 08:58:47 +0800
From: Dan Jacobson <jidanni@jidanni.org>
Subject: sed /5/d with as little blabbage
Message-Id: <87zn5mi7ug.fsf@jidanni.org>
Gentlemen, the challenge, to do as sed with as little blabbage,
$ seq 9|sed /5/d
$ seq 9|perl -ne 'next if /5/; print'
$ seq 9|perl -pe 'goto LINE if /5/'
Can I make it even shorter?
Perhaps this knows,
$ s2p '/5/d'|wc
123 459 2709
Never mind.
------------------------------
Date: 27 Jul 2004 21:03:34 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: sed /5/d with as little blabbage
Message-Id: <ce6fv6$7oe$1@mamenchi.zrz.TU-Berlin.DE>
Dan Jacobson <jidanni@jidanni.org> wrote in comp.lang.perl.misc:
> Gentlemen, the challenge, to do as sed with as little blabbage,
Challenge? Next.
[snip]
Anno
------------------------------
Date: 27 Jul 2004 21:10:40 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: sed /5/d with as little blabbage
Message-Id: <slrncgdh6g.6hs.abigail@alexandra.abigail.nl>
Dan Jacobson (jidanni@jidanni.org) wrote on MMMCMLXXXIII September
MCMXCIII in <URL:news:87zn5mi7ug.fsf@jidanni.org>:
.. Gentlemen, the challenge, to do as sed with as little blabbage,
.. $ seq 9|sed /5/d
.. $ seq 9|perl -ne 'next if /5/; print'
.. $ seq 9|perl -pe 'goto LINE if /5/'
.. Can I make it even shorter?
$ seq 9|perl -pe'$_=""if/5/'
Abigail
--
sub _ {$_ = shift and y/b-yB-Y/a-yB-Y/ xor !@ _?
exit print :
print and push @_ => shift and goto &{(caller (0)) [3]}}
split // => "KsvQtbuf fbsodpmu\ni flsI " xor & _
------------------------------
Date: 28 Jul 2004 03:52:08 GMT
From: Lukas Mai <rwxr-xr-x@gmx.de>
Subject: Re: sed /5/d with as little blabbage
Message-Id: <ce77t8$hlt$1@wsc10.lrz-muenchen.de>
Abigail schrob:
> Dan Jacobson (jidanni@jidanni.org) wrote on MMMCMLXXXIII September
> MCMXCIII in <URL:news:87zn5mi7ug.fsf@jidanni.org>:
> .. Gentlemen, the challenge, to do as sed with as little blabbage,
> .. $ seq 9|sed /5/d
> .. $ seq 9|perl -ne 'next if /5/; print'
> .. $ seq 9|perl -pe 'goto LINE if /5/'
> .. Can I make it even shorter?
> $ seq 9|perl -pe'$_=""if/5/'
TIMTOWTDI:
$ seq 9|perl -ne'/5/||print'
$ seq 9|perl -pe's/5\n//'
Lukas
--
use warnings; use strict;
sub hacker'Perl { "Perl @_,"} sub another'Just
{print"Just @_ "}
Just another Perl hacker,
------------------------------
Date: Wed, 28 Jul 2004 08:24:27 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: sed /5/d with as little blabbage
Message-Id: <x71xiwczf7.fsf@mail.sysarch.com>
>>>>> "LM" == Lukas Mai <rwxr-xr-x@gmx.de> writes:
LM> Abigail schrob:
>> Dan Jacobson (jidanni@jidanni.org) wrote on MMMCMLXXXIII September
>> MCMXCIII in <URL:news:87zn5mi7ug.fsf@jidanni.org>:
>> .. Gentlemen, the challenge, to do as sed with as little blabbage,
>> .. $ seq 9|sed /5/d
>> .. $ seq 9|perl -ne 'next if /5/; print'
>> .. $ seq 9|perl -pe 'goto LINE if /5/'
>> .. Can I make it even shorter?
>> $ seq 9|perl -pe'$_=""if/5/'
LM> TIMTOWTDI:
LM> $ seq 9|perl -ne'/5/||print'
LM> $ seq 9|perl -pe's/5\n//'
that last one isn't the same thing. it only deletes the line if it is
just has (really just ends with) "5\n". the rest delete the line if it
has '5' in it.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 28 Jul 2004 11:58:37 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: sed /5/d with as little blabbage
Message-Id: <pcteg09je61icutugq4diktjk0o0epgfqc@4ax.com>
On 27 Jul 2004 21:10:40 GMT, Abigail <abigail@abigail.nl> wrote:
>Dan Jacobson (jidanni@jidanni.org) wrote on MMMCMLXXXIII September
>MCMXCIII in <URL:news:87zn5mi7ug.fsf@jidanni.org>:
>.. Gentlemen, the challenge, to do as sed with as little blabbage,
>.. $ seq 9|sed /5/d
>.. $ seq 9|perl -ne 'next if /5/; print'
>.. $ seq 9|perl -pe 'goto LINE if /5/'
>.. Can I make it even shorter?
>
> $ seq 9|perl -pe'$_=""if/5/'
seq 9|perl -pe'$_ x=!/5/'
seq 9|perl -pe's/5.//s'
Michele
--
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
"perl bug File::Basename and Perl's nature"
------------------------------
Date: Wed, 28 Jul 2004 17:13:27 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: sed /5/d with as little blabbage
Message-Id: <k5gfg0le7lnk918165e0v9rcfq5nvtf9m0@4ax.com>
On Wed, 28 Jul 2004 08:24:27 GMT, Uri Guttman <uri@stemsystems.com>
wrote:
> LM> $ seq 9|perl -ne'/5/||print'
> LM> $ seq 9|perl -pe's/5\n//'
>
>that last one isn't the same thing. it only deletes the line if it is
>just has (really just ends with) "5\n". the rest delete the line if it
>has '5' in it.
But since we're dealing with seq 9 here, both scripts produce the same
output so that they're most definitely equivalent per the OP's
request. And as far as I can say they would be similarly considered
completely equivalent by most golfing rules...
Michele
--
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
"perl bug File::Basename and Perl's nature"
------------------------------
Date: 23 Jul 2004 20:48:58 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Self help change UNIX password through broswer - How to (NewBie)
Message-Id: <u9bri6fqs5.fsf@wcl-l.bham.ac.uk>
"NewBie" <leongyc@tp.edu.sg> writes:
> Is it possible to have a self help change unix password through broswer? If
> so, how to?
I suggest you take a look back at the answers given to the last couple
of dozen people to ask this question in this newsgroup. (Shouldn't be
too difficult the question is quite keywoed-rich).
You'll find the general consensus is: if you need to ask you shouldn't
be doing it.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Sat, 24 Jul 2004 20:28:26 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Self help change UNIX password through broswer - How to (NewBie)
Message-Id: <1o64g0p6qf03dlkjfmrignii2n0rugfnem@4ax.com>
On 23 Jul 2004 20:48:58 +0100, Brian McCauley <nobull@mail.com> wrote:
>> Is it possible to have a self help change unix password through broswer? If
>> so, how to?
>
>I suggest you take a look back at the answers given to the last couple
>of dozen people to ask this question in this newsgroup. (Shouldn't be
>too difficult the question is quite keywoed-rich).
>
>You'll find the general consensus is: if you need to ask you shouldn't
>be doing it.
While I fully agree on this, I have a question too. Not that I really
need this or have even asked the very same question, but I know that a
customary (safe) answer is "write to a file and have a scheduled cron
job running as root do the actual work". Now I wonder if one could use
a daemon instead (possibly reading from a pipe rather than from a
regular file): intuitively it seems to me that the answer should be
"yes", but maybe I'm not taking into account some delicate issue. Just
curious...
Michele
--
#!/usr/bin/perl -lp
BEGIN{*ARGV=do{open $_,q,<,,\$/;$_}}s z^z seek DATA,11,$[;($,
=ucfirst<DATA>)=~s x .*x q^~ZEX69l^^q,^2$;][@,xe.$, zex,s e1e
q 1~BEER XX1^q~4761rA67thb ~eex ,s aba m,P..,,substr$&,$.,age
__END__
------------------------------
Date: 28 Jul 2004 17:52:25 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Self help change UNIX password through broswer - How to (NewBie)
Message-Id: <u9n01kysza.fsf@wcl-l.bham.ac.uk>
Michele Dondi <bik.mido@tiscalinet.it> writes:
> On 23 Jul 2004 20:48:58 +0100, Brian McCauley <nobull@mail.com> wrote:
>
> >> Is it possible to have a self help change unix password through broswer? If
> >> so, how to?
> >
> >I suggest you take a look back at the answers given to the last couple
> >of dozen people to ask this question in this newsgroup. (Shouldn't be
> >too difficult the question is quite keywoed-rich).
> >
> >You'll find the general consensus is: if you need to ask you shouldn't
> >be doing it.
>
> While I fully agree on this, I have a question too. Not that I really
> need this or have even asked the very same question, but I know that a
> customary (safe) answer is "write to a file and have a scheduled cron
> job running as root do the actual work". Now I wonder if one could use
> a daemon instead (possibly reading from a pipe rather than from a
> regular file): intuitively it seems to me that the answer should be
> "yes", but maybe I'm not taking into account some delicate issue. Just
> curious...
I have always considered the helper application being either an SUID
application or connected via a pipe (or Unix domain socket) to be the
more "customary" approach.
Indeed you can even use /bin/passwd itself on some OSs.
Usually the helper needs (or at least wants) to (re-)validate the old
password before changing the password so you don't want that
information sitting about in some file.
This, of course, has nothing to do with Perl.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 3 Aug 2004 00:25:31 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: SOLUTION IDENTIFIED Re: Parsing form POST without CGI.pm on Win32
Message-Id: <Pine.LNX.4.61.0408030014460.651@ppepc56.ph.gla.ac.uk>
On Tue, 3 Aug 2004, Gunnar Hjalmarsson wrote:
> > The poster expressed surprise that forms submissions weren't
> > transmitted as plain text, for heaven's sake! Doesn't that tell
> > you something?
>
> I saw a quote from another forum,
This one, isn't it? :
| It has been discussed in other newsgroups and is an IE issue. Here
| is a post from microsoft.public.inetserver.iis
|
| "The problem is that the data in STDIN is encoded in
| application/x-www-form-urlencoded, not plain text.
Quite why the submission of a form in the normal WWW-specified
encoding should be a "problem" and an "IE issue" is beyond me,
frankly. But I see no indication that CGI.pm would not have coped
with this, if only it had been given the chance.
> but I read no surprise of the kind.
OK: maybe I was mistaken to interpret the uncritical regurgitation of
incompetence and confusion as "surprise".
------------------------------
Date: Tue, 03 Aug 2004 00:58:37 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: SOLUTION IDENTIFIED Re: Parsing form POST without CGI.pm on Win32
Message-Id: <2n7v9uFt86d8U1@uni-berlin.de>
Alan J. Flavell wrote:
> Gunnar Hjalmarsson wrote:
>> Matt, if you had read the whole thread, you'd know that a failure
>> to parse POSTed data with CGI.pm was the starting-point of the
>> thread.
>
> You must be reading an entirely different posting from what I'm
> seeing, then:
>
> | I use the CGI.pm module to 'paramitize' form post data.
> | Everything works well with this great module.
>
> Looks good so far. It which then went on to say:
<more quoted text from the OP's post snipped>
> I don't see anything there which says "CGI.pm cannot parse
> submissions on a Windows server" - do you?
Hmm.. Maybe I had misunderstood that. For some reason I had the
impression that the OP had failed to make the combination IE 6 + WinXP
Home + CGI.pm work as well, but now I'm in doubt. My apologies to Matt.
>> As regards the solution you mentioned, binmoding STDIN (which btw
>> was mentioned by Brian), I had a quick glance at the CGI.pm
>> source,
>
> CGI.pm handles it just fine. What you have to grasp, I think, is
> that the claim to be "using" CGI.pm in this sample code:
> ___
> /
> use CGI qw/:standard/;
> $CGI::POST_MAX=1024 * 100;
> $CGI::DISABLE_UPLOADS = 1;
>
> my (%in, $buffer);
> if ($ENV{REQUEST_METHOD} eq 'POST') {
> my $len = $ENV{CONTENT_LENGTH};
> $len <= 131072 or die "Too much data submitted.\n";
> read(STDIN, $buffer, $len) == $len
> or die "Reading of posted data failed.\n";
> } else { $buffer = $ENV{QUERY_STRING};
> }
> \___
>
> was - how shall I put it? - "much exaggerated".
To me, that was not a claim to be using CGI.pm for parsing the data.
My interpretation was that the first three lines were left from
previous attempts. (The rest is part of the code I posted.)
> The poster expressed surprise that forms submissions weren't
> transmitted as plain text, for heaven's sake! Doesn't that tell
> you something?
I saw a quote from another forum, but I read no surprise of the kind.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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.
#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 V10 Issue 6823
***************************************