Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Passing scalars to CGI module

by filmo (Scribe)
on Apr 14, 2001 at 05:39 UTC ( [id://72535]=note: print w/replies, xml ) Need Help??


in reply to Passing scalars to CGI module

Okay, just wanted to thank everybody for their help. This is truely the great thing about the Perl community. Below is my final code, which now works as I had hoped. I changed the data structure to be hash of hash as suggested. It's a lot clearer.
%sample = { 'short' =>{name=>"Job ID", width=>40, cgi=>{method=>'textfield',field=>'short',size=>15,max=>10}, div=>"center"}, 'name' =>{name=>"Job Name", width=>150, cgi=>{method=>'textfield',field=>'name',size=>35}} }; foreach (keys %sample) { $method = $sample{$_}{'cgi'}{'method'}; # if method doesn't exist, you get undef sub error in CGI pm if ($method) { print $q->$method(-name=>$job{$_}{'cgi'}{'field'}, -default=>$job{$_}{'cgi'}{'default'}, -size=>$job{$_}{'cgi'}{'size'}, -maxlength=>$job{$_}{'cgi'}{'max'} ); } print "\n"; }
--
Filmo the Klown

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-20 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found