perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ken Y. Clark" <kcl...@logsoft.com>
Subject Re: CGI.pm - Unnamed parameter
Date Tue, 06 Nov 2001 13:24:15 GMT
On Fri, 2 Nov 2001, James Wilson wrote:

> Date: Fri, 2 Nov 2001 01:42:13 +0000 (GMT)
> From: James Wilson <tau@j2w.co.uk>
> To: modperl@apache.org
> Subject: CGI.pm - Unnamed parameter
>
> Hi,
>
> Hopefully a quick and easy question...
>
> I'm accessing as follows:
>
> /cgi-bin/script.pl?data
>
> And want to know how to get 'data' from somewhere using CGI.pm
>
> Am familiar with using $cgi->param{'it'} to read .../script.pl?it=data
> and also using $cgi->path_info() to read .../script.pl/data
> but I don't know how to get at it using the format at the top. I've
> noticed from experiment that given /script.pl?data, I seem to be
> able to get it using $cgi->param{'keywords'}, but if I am using
> .../script.pl?param=value&data then I can access 'value' from
> $cgi->param{'param'}, but can no longer get 'data' from
> $cgi->param{'keywords'}
>
> I'm therefore obviously concerned about just asssuming that
> $cgi->param{'keywords'} will return 'data' given an access of
> .../script.pl?data as I can find no reference in CGI.pm docs
> about this being a standard behaviour.
>
> Does anyone know a fail-safe way of retrieving 'data'
> using a CGI.pm call given an access as above ???
>
> Thanks,
>
> James

James,

Do you have to use CGI.pm?  Why not use the Apache::Request module?
It's much quicker and powerful, IMO.  $apr->path_info() should work
just fine for you, but it's only going to give you the "data" part of
"/script.pl?data."

Also, if you're going to stick to using CGI.pm, why are you saying
"$cgi->param{'foo'}" and not making the method call,
"$cgi->param('foo')"?

ky


Mime
View raw message