Stas Bekman wrote:

Carl Brewer wrote:


My appologies, I've tried to grok this from the doco, but must have missed it somewhere while trying to parse apache::request somehow?


You mean Apache::RequestRec. Apache::Request is a 3rd party module.

I've got a script, I want to grab submitted values to it
of the form :

http://foo.bar/perl/script.pl?a=4

And I want to be able to work out what "a" is within script.pl,
ie, within the script I want to set a to "4", or whatever it
gets called as.

I know this is trivially easy to do with CGI.pm,
but how do I do it without CGI.pm?  (caveats
concerning taint etc appreciated)


print $r->args;

Perfect.


I found that just after I posted the email too .. *doh*

prints "a=4", you can also do:

$r->args("a=5");

Is that what you are after?

Yes. Out of curiosity, why would setting the argument be of any use? It's come in from the URL supplied by the browser, you'd change it for some filter maybe?

I've set PerlSwitches -T in httpd.conf, which I thought would
taint the value of $r->args, but I can merrily print it out
without any parsing, which seems wrong to me, any clues?

Also see the guts of Apache/compat.pm for how it provides the backcompat functionality of doing:

my %args = $r->args;

The doco says that's evil, or at least it is in an array context, not a hash?

don't expect this to ever be part of the mp2 API, it's CGI.pm or Apache::Request that (will) do that job.

*nod*


I'm also trying to get my head around retrieving data from a POST
form, which I don't think I can get with $r->args?  In the
absence of Apache::Request and CGI.pm what's the most appropriate
mp2-pure way to get form data submitted by a POST form?

Something using APR::Table ?

any examples? :)

Carl





Reply via email to