Hi modperls,
Apache/1.3.26 (Unix) mod_perl/1.27
I have started getting odd results from requests that come from forms with multiple options. If I pass the following uri all is well:
http://server.com/junk?one=1&two=2&three=3
But this doesn't http://server.com/junk?no=1&no=2&no=3
Well to be fair it does work if I put the list into an array but if I use a hash reference it doesn't and I can only access the first item.
Apache::Request::param will only return a list if it is called in list context. This means you may have to force it to return a list using ()
like this ($r->param('my_param')).
But it looks like you are trying to put the values of your params as keys to a hash. You can't have a list be a key to a hash.
HTH
Michael Peters Developer Plus Three
What am I doing wrong?? Sorry if this is a bit OT but I am not sure if this is a modperl issue or a perl reference knowledge void.
Thanx.
Dp.
========== JUNK.PM =============== package SPL::junk;
use Apache::Constants qw(:common REDIRECT); use Apache::Request; use Apache::File; use strict; use warnings; use diagnostics; use Carp;
$| =1;
sub handler{
my $r = Apache::Request->new(shift); # my $hash_ref; my @users;
foreach my $param ($r->param) { print STDERR "\$r->$param = ".scalar($r->param($param))."\n"; # $hash_ref->{$r->param($param)} = 0; push(@users,$r->param($param)); }
# foreach my $ref (keys %{$hash_ref}) { # print STDERR "$ref -> $hash_ref->{$ref}\n"; # }
foreach my $u (@users) { print STDERR "user = $u\n"; }
return OK; } # End of handler 1;
~~ Dermot Paikkos * [EMAIL PROTECTED] Network Administrator @ Science Photo Library Phone: 0207 432 1100 * Fax: 0207 286 8668
-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html