Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^7: Building data structures from CGI params

by Anonymous Monk
on Aug 09, 2012 at 08:30 UTC ( #986445=note: print w/ replies, xml ) Need Help??


in reply to Re^6: Building data structures from CGI params
in thread Building data structures from CGI params

I like that better than expecting a ->param, since that breaks it away from the contract of purely hash->hash.

Adding a branch breaks no contracts

sub build_cgi_struct { my ($iv, $errs, $conf) = @_; use Scalar::Util qw(blessed); my $blessed = blessed $iv; my $splitnull = 1; if( $blessed and UNIVERSAL::can( $iv, 'param') ){ $splitnull = 0; if( $iv->isa('CGI') ){ $iv = $iv->{"param"} ; # cheat :) } else { $iv = { map { $_ => [ $iv->param($_) ] } $iv->param }; } } ... ... if $splitnull;


Comment on Re^7: Building data structures from CGI params
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://986445]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (17)
As of 2015-07-01 20:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (19 votes), past polls