[23835] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 6038 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 29 21:56:41 2004

Date: Thu, 29 Jan 2004 18:51:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 29 Jan 2004     Volume: 10 Number: 6038

Today's topics:
        Perl Taint issue <Mark.Fenbers@noaa.gov>
    Re: Perl Taint issue (Walter Roberson)
    Re: Perl Taint issue <gnari@simnet.is>
    Re: Perl Taint issue <noreply@gunnar.cc>
    Re: Perl Taint issue <Mark.Fenbers@noaa.gov>
        Perl-Cgi Newbee! (Andrew)
    Re: Perl-Cgi Newbee! <gnari@simnet.is>
    Re: Perl-Cgi Newbee! <noreply@gunnar.cc>
    Re: Perl-Cgi Newbee! <tadmc@augustmail.com>
        PIPE in and out at the same time <ewald_peters@yahoo.com>
    Re: PIPE in and out at the same time <spamtrap@dot-app.org>
    Re: PIPE in and out at the same time <ewald_peters@yahoo.com>
    Re: PIPE in and out at the same time (Walter Roberson)
    Re: PIPE in and out at the same time <usenet@morrow.me.uk>
        Possible CGI.pm defect (Moulin Kluge)
    Re: Possible CGI.pm defect <1usa@llenroc.ude>
    Re: Possible CGI.pm defect <uri@stemsystems.com>
    Re: Possible CGI.pm defect <1usa@llenroc.ude>
        POST to URL with query string and CGI.pm <richard@zync.co.uk>
    Re: POST to URL with query string and CGI.pm <nobull@mail.com>
    Re: POST to URL with query string and CGI.pm <richard@zync.co.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 28 Jan 2004 13:02:51 -0500
From: Mark J Fenbers <Mark.Fenbers@noaa.gov>
Subject: Perl Taint issue
Message-Id: <4017F94B.595AF7A@noaa.gov>

Consider this stripped-down Perl script:

#!/usr/bin/perl -w -T
use strict;

foreach $file ( <ahps.dat.???> ) {
    open(OUT, ">$file.new") or die "message...";
    # do stuff;
    close OUT;
}

I get a taint dependency error on the "open" statement.  The "perlsec" man page
says this is a tainted situation (and I understand why), but it offers little
advice of how to get around it.  In the unstripped program, given filenames such
as "ahps.dat.cle", I want to read in data from the file, modify the data, and
write the altered data back out to a file called "ahps.dat.cle.new" for human
examination... but it won't let me do this with "-T" unless I hardwire the
output filename (which isn't a reasonable solution).

Any ideas to get around this?

Mark



------------------------------

Date: 28 Jan 2004 19:03:12 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Perl Taint issue
Message-Id: <bv911g$5f4$1@canopus.cc.umanitoba.ca>

In article <4017F94B.595AF7A@noaa.gov>,
Mark J Fenbers  <Mark.Fenbers@noaa.gov> wrote:
:Consider this stripped-down Perl script:

:#!/usr/bin/perl -w -T
:use strict;

:foreach $file ( <ahps.dat.???> ) {
:    open(OUT, ">$file.new") or die "message...";
:    # do stuff;
:    close OUT;
:}

:I get a taint dependency error on the "open" statement.  The "perlsec" man page
:says this is a tainted situation (and I understand why), but it offers little
:advice of how to get around it.

Use the standard de-tainting idiom:

#!/usr/bin/perl -w -T
use warnings;
use strict;

foreach my $taintedfile ( <ahps.dat.??> ) {
  my $file = $taintedfile =~ m/^(.*)$/;
  open(OUT, ">$file.new") or die "message...";
  # do stuff;
  close OUT;
}
-- 
   "[...] it's all part of one's right to be publicly stupid." -- Dave Smey


------------------------------

Date: Wed, 28 Jan 2004 18:28:21 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Perl Taint issue
Message-Id: <bv8v5p$6te$1@news.simnet.is>

"Mark J Fenbers" <Mark.Fenbers@noaa.gov> wrote in message
news:4017F94B.595AF7A@noaa.gov...
> Consider this stripped-down Perl script:
>
> #!/usr/bin/perl -w -T
> use strict;
>
> foreach $file ( <ahps.dat.???> ) {
>     open(OUT, ">$file.new") or die "message...";
>     # do stuff;
>     close OUT;
> }
>
> I get a taint dependency error on the "open" statement.  The "perlsec" man
page
> says this is a tainted situation (and I understand why), but it offers
little
> advice of how to get around it.  In the unstripped program, given
filenames such
> as "ahps.dat.cle", I want to read in data from the file, modify the data,
and
> write the altered data back out to a file called "ahps.dat.cle.new" for
human
> examination... but it won't let me do this with "-T" unless I hardwire the
> output filename (which isn't a reasonable solution).
>
> Any ideas to get around this?

doesn't the usual work?
if ($file=~/(^ahps\.dat\.[a-z]{3})$/) { # for example
    my $newfile="$1.new";
   # do stuff
}

gnari





------------------------------

Date: Wed, 28 Jan 2004 20:36:24 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Perl Taint issue
Message-Id: <bv937i$pos3f$1@ID-184292.news.uni-berlin.de>

Walter Roberson wrote:
> Use the standard de-tainting idiom:
> 
> #!/usr/bin/perl -w -T
> use warnings;
> use strict;
> 
> foreach my $taintedfile ( <ahps.dat.??> ) {
>   my $file = $taintedfile =~ m/^(.*)$/;
-------^^^^^----------------------^^^^

What's standard about that buggy code?

First, if you consider /^(.*)$/ to be "standard" for untainting, you 
can as well just remove the -T switch. Please study

     http://www.perldoc.com/perl5.8.0/pod/perlsec.html

for some advice on how it should be done.

Second, $file in the above code will be assigned the number 1, i.e. 
the return value of the match in scalar context.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Wed, 28 Jan 2004 15:30:59 -0500
From: Mark J Fenbers <Mark.Fenbers@noaa.gov>
To: gnari <gnari@simnet.is>
Subject: Re: Perl Taint issue
Message-Id: <40181C03.DC1907D2@noaa.gov>

Yes, this works!  Thank you!
Mark

gnari wrote:

> "Mark J Fenbers" <Mark.Fenbers@noaa.gov> wrote in message
> news:4017F94B.595AF7A@noaa.gov...
> > Consider this stripped-down Perl script:
> >
> > #!/usr/bin/perl -w -T
> > use strict;
> >
> > foreach $file ( <ahps.dat.???> ) {
> >     open(OUT, ">$file.new") or die "message...";
> >     # do stuff;
> >     close OUT;
> > }
> >
> > I get a taint dependency error on the "open" statement.  The "perlsec" man
> page
> > says this is a tainted situation (and I understand why), but it offers
> little
> > advice of how to get around it.  In the unstripped program, given
> filenames such
> > as "ahps.dat.cle", I want to read in data from the file, modify the data,
> and
> > write the altered data back out to a file called "ahps.dat.cle.new" for
> human
> > examination... but it won't let me do this with "-T" unless I hardwire the
> > output filename (which isn't a reasonable solution).
> >
> > Any ideas to get around this?
>
> doesn't the usual work?
> if ($file=~/(^ahps\.dat\.[a-z]{3})$/) { # for example
>     my $newfile="$1.new";
>    # do stuff
> }
>
> gnari



------------------------------

Date: 24 Jan 2004 01:18:10 -0800
From: arobcorp@yahoo.com.au (Andrew)
Subject: Perl-Cgi Newbee!
Message-Id: <9e8ef4c1.0401240118.1735134c@posting.google.com>

Hi all and thanks in advance of any help given!.
I have a perl-cgi program, and it takes data passed to it from a HTML
form and processes it. The program can check to make sure the fields
are filled in and are valid, but I need to check the actual e-mail
address to conferm that it is one that the program is suppose to send
to!, see below for better understanding!:-

@myArray=(nowhere.com.uk, somewhere.com.au, somewhereelse.com.us);

#yack yack yack!!!

($emailName, $emailAddress)=split(/@/, $form{$email}, 2);
________________________

the $emailName & $emailAddress are being set right, but when I try to
write a
a loop (for, if, foreach (also used =~ !~ == eq ne !=(I give up!))) it
doesn't work!, the result is it doesn't tell the diference between
ones on the list and ones that arn't!.

Could some-one be kind enough write a simple loop that could scan the
array @myArray and compare to the $emailAddress.
Thanks Heaps
Andrew


------------------------------

Date: Sat, 24 Jan 2004 10:32:51 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Perl-Cgi Newbee!
Message-Id: <buthq4$kmt$1@news.simnet.is>

"Andrew" <arobcorp@yahoo.com.au> wrote in message
news:9e8ef4c1.0401240118.1735134c@posting.google.com...
> @myArray=(nowhere.com.uk, somewhere.com.au, somewhereelse.com.us);
> ...
> ($emailName, $emailAddress)=split(/@/, $form{$email}, 2);
>
> the $emailName & $emailAddress are being set right, but when I try to
> write a
> a loop (for, if, foreach (also used =~ !~ == eq ne !=(I give up!))) it
> doesn't work!, the result is it doesn't tell the diference between
> ones on the list and ones that arn't!.

it might be instructive if you show us what fails, so that we can point out
your problem.

personally, I use a hash in this kind of situations

my %addresses = map {$_ => 1} @myArray;
if ($addresses{$emailAddress}) {
  #bla bla ...
} else {
  # error message or something
}

gnari







------------------------------

Date: Sat, 24 Jan 2004 12:15:56 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Perl-Cgi Newbee!
Message-Id: <butkdh$lsosp$1@ID-184292.news.uni-berlin.de>

Andrew wrote:
> 
> @myArray=(nowhere.com.uk, somewhere.com.au, somewhereelse.com.us);

Enable strictures and warnings, and my() declare all the variables.
That way Perl might help you get it right.

     use strict;
     use warnings;

> Could some-one be kind enough write a simple loop that could scan
> the array @myArray and compare to the $emailAddress.

Please post a small program, with strictures and warnings enabled,
that people can run, and that includes your attempt to check
$emailAddress. If you do, somebody can help you correct the code.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Sat, 24 Jan 2004 09:50:14 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl-Cgi Newbee!
Message-Id: <slrnc1551m.4hc.tadmc@magna.augustmail.com>

Andrew <arobcorp@yahoo.com.au> wrote:

> Hi all and thanks in advance of any help given!.


Here is some help:

   Please see the Posting Guidelines that are posted here frequently.


> @myArray=(nowhere.com.uk, somewhere.com.au, somewhereelse.com.us);


You should put quotes around strings.

    Ask perl to help you
        You can ask perl itself to help you find common programming mistakes
        by doing two things: enable warnings (perldoc warnings) and enable
        "strict"ures (perldoc strict).


> ($emailName, $emailAddress)=split(/@/, $form{$email}, 2);


How is %form being populated?

Are you using CGI.pm?


> when I try to
> write a
> a loop (for, if, foreach 
  ^^^^^^
  ^^^^^^

"if" is NOT a loop.


> Could some-one be kind enough write a simple loop that could scan the
> array @myArray and compare to the $emailAddress.


Sure, but that is likely not the best solution to your problem...

You _could_ use the implicit loop that grep() gives you:

   if ( grep $_ eq $emailAddress, @myArray )


But that will be inefficient if @myArray is "large".  In that case,
I would do it as suggested in the answer from the Perl FAQ:

   How can I tell whether a certain element is contained in a list or array?

(ie. use a hash instead of @myArray)


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Tue, 20 Jan 2004 00:35:37 +0100
From: Ewald Peters <ewald_peters@yahoo.com>
Subject: PIPE in and out at the same time
Message-Id: <400C69C9.97FC4393@yahoo.com>

*** post for FREE via your newsreader at post.newsfeed.com ***

Dear Programmers!

Did i miss something, or is it impossible to open a pipe
for writing and reading at the same time?

I'm stuck with

open(PIPE, "| commandname")

but i can't read the output of this shell command
to which i first want to submit data via STDIN
and then i want to read STDOUT

open(PIPE_IN_AND_OUT, "| commandname |")
doesn't work.

I didn't find information about this in the web
but it seems so be also a general problem
of programming.

Thanx in advance

Ewald


 -----= Posted via Newsfeed.Com, Uncensored Usenet News =-----
http://www.newsfeed.com - The #1 Newsgroup Service in the World!
-----== 100,000 Groups! - 19 Servers! - Unlimited Download! =-----
                  


------------------------------

Date: Mon, 19 Jan 2004 23:51:20 GMT
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: PIPE in and out at the same time
Message-Id: <pan.2004.01.19.23.51.19.696146@dot-app.org>

On Tue, 20 Jan 2004 00:35:37 +0100, Ewald Peters wrote:

> Did i miss something, or is it impossible to open a pipe
> for writing and reading at the same time?

Have a look at the IPC::Open2 and IPC::Open3 modules.

sherm--


------------------------------

Date: Sat, 24 Jan 2004 09:28:09 +0100
From: Ewald Peters <ewald_peters@yahoo.com>
Subject: Re: PIPE in and out at the same time
Message-Id: <40122C99.A1C7C199@yahoo.com>

*** post for FREE via your newsreader at post.newsfeed.com ***

> Sherm Pendley schrieb:
> >
> > Have a look at the IPC::Open2 and IPC::Open3 modules.
> >
> 
> Thanx for the constructive hint!

Sorry, one last question, i know i could have posted this
in the C-Newsgroup, but is there a way to do
the simultanious in-and-out-piping in C somehow,
just the same as IPC::OpenX?

Thanx

Ewald


 -----= Posted via Newsfeed.Com, Uncensored Usenet News =-----
http://www.newsfeed.com - The #1 Newsgroup Service in the World!
-----== 100,000 Groups! - 19 Servers! - Unlimited Download! =-----
                  


------------------------------

Date: 24 Jan 2004 08:46:28 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: PIPE in and out at the same time
Message-Id: <butbd4$p3j$1@canopus.cc.umanitoba.ca>

In article <40122C99.A1C7C199@yahoo.com>,
Ewald Peters  <ewald_peters@yahoo.com> wrote:
:Sorry, one last question, i know i could have posted this
:in the C-Newsgroup, but is there a way to do
:the simultanious in-and-out-piping in C somehow,
:just the same as IPC::OpenX?

IPC:Open2 corresponds most closely to the standard POSIX call popen().

IPC:Open3 has no simple equivilent. It requires some careful
uses of dup() and close() and pipe() before a fork() / exec() pair 
and then some additional close() and dup() in the main process
to get back the way they were.

-- 
   Oh, to be a Blobel!


------------------------------

Date: Sat, 24 Jan 2004 12:20:50 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: PIPE in and out at the same time
Message-Id: <butnv2$9be$2@wisteria.csv.warwick.ac.uk>


roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote:
> In article <40122C99.A1C7C199@yahoo.com>,
> Ewald Peters  <ewald_peters@yahoo.com> wrote:
> :Sorry, one last question, i know i could have posted this
> :in the C-Newsgroup, but is there a way to do
> :the simultanious in-and-out-piping in C somehow,
> :just the same as IPC::OpenX?
> 
> IPC:Open2 corresponds most closely to the standard POSIX call popen().

Err... popen only opens one pipe, for reading *or* writing. I don't
think there is any way in ANSI C to do an open2. On POSIX systems you
can use pipe/pipe/fork/dup2/dup2/exec as you said.

Ben

-- 
   Razors pain you / Rivers are damp
   Acids stain you / And drugs cause cramp.                    [Dorothy Parker]
Guns aren't lawful / Nooses give
  Gas smells awful / You might as well live.                   ben@morrow.me.uk


------------------------------

Date: 27 Jan 2004 17:14:30 -0800
From: enunna@yahoo.com (Moulin Kluge)
Subject: Possible CGI.pm defect
Message-Id: <cea64688.0401271714.c8d0e92@posting.google.com>

Hello all,

I'm using CGI.pm to upload a file to the web server, and it worked
using Redhat 7.3.  I upgraded to 9, using Apache2.0.40, mod_perl 1.99,
and 3.04 of CGI.pm, and it no longer works.  Here's the error log I
get:

[Tue Jan 27 16:47:34 2004] -e: Use of uninitialized value in <HANDLE>
at /var/www/cgi-bin/trakker/test.pl line 541.
[Tue Jan 27 16:47:34 2004] -e: readline() on unopened filehandle at
/var/www/cgi-bin/trakker/test.pl line 541.

The reason I think that's may be a problem with CGI.pm is because I
can remove an included module that also uses CGI.pm, and the code
works again, making me think that somehow multiple CGI objects are
interacting and invalidating the file upload handle.  Here's the code,
in case I'm doing something funny that I'm not seeing:

    my $uploadfile = $query->param('uploadfile');
    my $filename; 

    if ($uploadfile =~ /([^\/\\]+)$/)
    {   
        $filename="$1";
    }   
    else
    {   
        $filename="$uploadfile";
    }

    my $writefile = "$conf{uploaddir}/$filename";

    open(OUTFILE,">$writefile")
        or die "Problem writing file after upload";
    
    binmode OUTFILE;

    while (<$uploadfile>)
    {
        print OUTFILE $_;
    }
                
    close(OUTFILE);

Thanks for any help.


------------------------------

Date: 28 Jan 2004 04:58:42 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: Possible CGI.pm defect
Message-Id: <Xns947DF3ED1B806asu1cornelledu@132.236.56.8>

enunna@yahoo.com (Moulin Kluge) wrote in news:cea64688.0401271714.c8d0e92
@posting.google.com:

> Hello all,
> 
> I'm using CGI.pm to upload a file to the web server, and it worked
> using Redhat 7.3.  I upgraded to 9, using Apache2.0.40, mod_perl 1.99,
> and 3.04 of CGI.pm, and it no longer works.  Here's the error log I
> get:
> 
> [Tue Jan 27 16:47:34 2004] -e: Use of uninitialized value in <HANDLE>
> at /var/www/cgi-bin/trakker/test.pl line 541.
> [Tue Jan 27 16:47:34 2004] -e: readline() on unopened filehandle at
> /var/www/cgi-bin/trakker/test.pl line 541.

I have no idea what your problem is because you have not provided a short 
example that we can run and test.

> The reason I think that's may be a problem with CGI.pm is because I
> can remove an included module that also uses CGI.pm, and the code
> works again, making me think that somehow multiple CGI objects are
> interacting and invalidating the file upload handle.

I have read this sentence several times but I cannot understand what you 
are talking about. What is this other module? If everything works when 
you remove the mystery module, why do assume the problem is with CGI.pm?

> Here's the code, in case I'm doing something funny that I'm not 
> seeing:

There are many funny things with the code. Have you actually read:

http://search.cpan.org/~lds/CGI.pm-
3.04/CGI.pm#CREATING_A_FILE_UPLOAD_FIELD

>     my $uploadfile = $query->param('uploadfile');
>     my $filename; 
> 
>     if ($uploadfile =~ /([^\/\\]+)$/)

Ouch. You could just use $uploadfile =~ !([^/\]+)$!

OTOH, why are you even doing this? $uploadfile is the name of the file on 
the system the web site visitor is using. This seems like a meaningless 
check to me. 

>     {   
>         $filename="$1";

Don't quote everything you see. This is a FAQ. Do read the FAQ.

>     }   
>     else
>     {   
>         $filename="$uploadfile";
>     }


ditto.
 
>     my $writefile = "$conf{uploaddir}/$filename";

ditto.

> 
>     open(OUTFILE,">$writefile")
>         or die "Problem writing file after upload";
>     
>     binmode OUTFILE;
> 
>     while (<$uploadfile>)
>     {
>         print OUTFILE $_;
>     }
>                 
>     close(OUTFILE);
> 
> Thanks for any help.

 
Read http://search.cpan.org/~lds/CGI.pm-
3.04/CGI.pm#CREATING_A_FILE_UPLOAD_FIELD



-- 
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)


------------------------------

Date: Wed, 28 Jan 2004 06:16:22 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Possible CGI.pm defect
Message-Id: <x7ektk4myx.fsf@mail.sysarch.com>

>>>>> "ASU" == A Sinan Unur <1usa@llenroc.ude> writes:

  >> $filename="$1";

  ASU> Don't quote everything you see. This is a FAQ. Do read the FAQ.

agreed on both points.

  >> $filename="$uploadfile";

  ASU> ditto.

ditto
 
  >> my $writefile = "$conf{uploaddir}/$filename";

  ASU> ditto.

that needs the quotes.

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: 28 Jan 2004 23:28:57 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude>
Subject: Re: Possible CGI.pm defect
Message-Id: <Xns947EBC046E7A1asu1cornelledu@132.236.56.8>

Uri Guttman <uri@stemsystems.com> wrote in 
news:x7ektk4myx.fsf@mail.sysarch.com:

>>>>>> "ASU" == A Sinan Unur <1usa@llenroc.ude> writes:
>  
>  >> my $writefile = "$conf{uploaddir}/$filename";
> 
>   ASU> ditto.
> 
> that needs the quotes.
> 
> uri

Hey, thanks for catching that. I went a little overboard on my dittos. 

On the other hand, I do prefer catfile in File::Spec to this style.



-- 
A. Sinan Unur
1usa@llenroc.ude (reverse each component for email address)


------------------------------

Date: Fri, 23 Jan 2004 16:03:14 +0000
From: "Richard Gration" <richard@zync.co.uk>
Subject: POST to URL with query string and CGI.pm
Message-Id: <burgk2$es$1@news.freedom2surf.net>

I was just wondering how many people recognise these comments from
CGI.pm, and how many people have spent hours debugging to trace the cause
to not getting what they expect when their form actions have a query
string on the end ... ?

      # Some people want to have their cake and eat it too!
      # Uncomment this line to have the contents of the query string
      # APPENDED to the POST data.

Grrr. ;-)

Is there a way to recover the decoded query string parameters (and
values) for a POST request from CGI.pm without tweaking the source in
this way? I suspect not ...

Rich


------------------------------

Date: 23 Jan 2004 17:16:49 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: POST to URL with query string and CGI.pm
Message-Id: <u9u12m8u0u.fsf@wcl-l.bham.ac.uk>

"Richard Gration" <richard@zync.co.uk> writes:

> I was just wondering how many people recognise these comments from
> CGI.pm, and how many people have spent hours debugging to trace the cause
> to not getting what they expect when their form actions have a query
> string on the end ... ?
> 
>       # Some people want to have their cake and eat it too!
>       # Uncomment this line to have the contents of the query string
>       # APPENDED to the POST data.
> 
> Grrr. ;-)
> 
> Is there a way to recover the decoded query string parameters (and
> values) for a POST request from CGI.pm without tweaking the source in
> this way? I suspect not ...

I suspect you are wrong.  From perldoc CGI

       It is possible for a script to receive CGI parameters in
       the URL as well as in the fill-out form by creating a form
       that POSTs to a URL containing a query string (a "?" mark
       followed by arguments).  The param() method will always
       return the contents of the POSTed fill-out form, ignoring
       the URL's query string.  To retrieve URL parameters...

Finding this extract in "perldoc CGI" to discover how that sentence
ends is left as an exercise for the reader :-) 

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: Fri, 23 Jan 2004 20:07:19 +0000
From: Richard Gration <richard@zync.co.uk>
Subject: Re: POST to URL with query string and CGI.pm
Message-Id: <ccfQb.615$MM5.312@news-binary.blueyonder.co.uk>

Brian McCauley wrote:

> "Richard Gration" <richard@zync.co.uk> writes:
> <SNIP>
>> Is there a way to recover the decoded query string parameters (and
>> values) for a POST request from CGI.pm without tweaking the source in
>> this way? I suspect not ...
> 
> I suspect you are wrong.  From perldoc CGI
> 
>        It is possible for a script to receive CGI parameters in
>        the URL as well as in the fill-out form by creating a form
>        that POSTs to a URL containing a query string (a "?" mark
>        followed by arguments).  The param() method will always
>        return the contents of the POSTed fill-out form, ignoring
>        the URL's query string.  To retrieve URL parameters...
> 
> Finding this extract in "perldoc CGI" to discover how that sentence
> ends is left as an exercise for the reader :-)
> 

OK, I'm a small mammal from Greenland. <blushes>

Thanks for the pointer :-) I did read the CGI docs but didn't see that. I 
certainly won't forget it after this afternoon's debugging exploits. 
Funniest thing is that the source tweak is much easier to find than the 
relevant comment in the docs, 'cos it's only a few hundred lines from the 
top of CGI.pm as opposed to a few thousand lines into the docs! I suspect 
I'll have a problem when I upgrade the module, and I suspect I'll be right 
about that suspicion ;-)

Cheers
Rich


------------------------------

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 6038
***************************************


home help back first fref pref prev next nref lref last post