Robert Mathews wrote:
> 
> > Parse the CGI GET/POST request, returning CGI variables into %CGI
> > (regardless of the source) in an un-HTTP escaped fashion
> 
> How are you going to handle multiple values for the same parameter?
> With CGI.pm, you can say
>   @values = $q->param("foo");
> 
> Are you going to make the values of %CGI listrefs?  That should have
> been spelled out before you froze the RFC.  Also, it seems a bit
> inconvenient if you always have to say C<$CGI{bar}[0]> when you just
> want one value.

Two choices as I see it:

1. make a listref only for multiple values:

   @name = @{$CGI{name}} if ( ref $CGI{name} eq 'ARRAY' );

2. make it a comma-delimited string:

   $name = $CGI{name};
   @name = split ',', $name;

The problem arises if your data has commas in it. Then you're hosed. So
door #1 might be the only solution.

But I don't think listrefs are needed in all contexts, since you should
know which elements will likely have multiple values (checkboxes, etc).
But having a direct data access method like %CGI does create this
problem. Shit.

Maybe %CGI is tied. Fast embedded tie, like in Perl 6. :-)

-Nate

Reply via email to