Does that explain, if I use the version of junk.pm below, with this 
uri: 
http://dev.sciencephoto.co.uk/junk?no=1&no=2&no=3
I get:

$r->no = 1
user = 1
user = 2
user = 3

and 
http://dev.sciencephoto.co.uk/junk?one=1&two=2&three=3
gives:

$r->one = 1
$r->two = 2
$r->three = 3
user = 1
user = 2
user = 3

Even as a list, you only seem to be given the form name once if all 
the elements are the same. But your right what I want is the form 
values as keys in my hash.

But what happens when I uncomment the $hash_ref lines is this:
$r->no = 1
1 -> 0

I a bit surprised as the cookbook says that using $r = shift "will 
remove any likes named pairs". That's why I am using Apache::Request. 


Thanx.
Dp.


 



On 30 Jul 2004 at 12:18, Michael wrote:

> Dermot Paikkos wrote:
> > 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
> 
> 


~~
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

Reply via email to