From: "JupiterHost.Net" <[EMAIL PROTECTED]>
> Charles K. Clarkson wrote:
> 
> > Manas Kulkarni <[EMAIL PROTECTED]> wrote:
> > 
> > : %in = $query->Vars; # get the form data into a hash
> > : 
> > 
> >    Arrgh! I have never understood the desire to immediately 
> > place all parameters in a hash. This replaces all that.
> 
> I hear ya!
> 
> Left overs from the old cgi-lib days when it was all pput in %FORM or
> %IN or something like that :)
> 
> It is much wiser to use CGI for param() and upload() and not reverting
> back to ancient ways :)

Sorry? How is

        foo( -name => $cgi->param("name"), -email => $cgi->param('email'));

better than

        foo( -name => $query{name}, -email => $query{email});

?
(and I'm not talking about writing your own code for parsing the 
query or posted data, but about using a module that gives you the 
data in a hash or about copying them to a hash by $cgi->Vars()!)

Not only is the second shorter, it's also less likely to end up 
causing hard to understand bugs.

Do you see the catch in the code above?

...

...

...

Imagine the query contained two parameters called "name".

...

In the first case you end up calling foo with something like this:

        foo( '-name', 'Jenda', 'Charles', '-email', '[EMAIL PROTECTED]');

in the second it'd be either

        foo( '-name', 'Jenda, Charles', '-email', '[EMAIL PROTECTED]');

or

        foo( '-name', 'Charles', '-email', '[EMAIL PROTECTED]');

(this depends on the way the hash is constructed)

> Like growing your first mustache but still wearing diapers ;p
> You can do it if you want but its a bit odd :)

I don't think this fits.

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to