Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Problems with scripts

by arturo (Vicar)
on Nov 27, 2000 at 02:47 UTC ( [id://43412]=note: print w/replies, xml ) Need Help??


in reply to Problems with scripts

First: if you're using the OO interface, you don't need to import anything (which is what your qw(param standard) is supposed to do) (explanation: the list of names you pass the module when you use it tells it that it is to "export" a number of functions into the calling package's namespace; so you can call (e.g.)"param" function without prepending "CGI::" to it. The OO interface makes all those functions methods of the query object, and so there's no need to *import* them).

the "uninitialized" problem in line 20 occurs because, evidently, no paramter named "place" is being passed to the script. Have you tried it from the command line (add "place=links" or some such when you run it. CTRL-D will end the input of name-value pairs) The solution to a problem like this is usually something like:

my $val = $query->param('foo') || 'default value';

Second pointer: CGI.pm can handle arrays, as I found out some time ago by asking on this very site. (link to follow => Passing arrays to a CGI read Fastolfe's post ). The basic idea here is that you put any number of fields with the same name in your HTML form, and CGI will return them as an array if you request it as such, i.e.

my @texts = $query->param('text');
will store all the returned fields named 'text' into the array.

HTH for a start.

Philosophy can be made out of anything. Or less -- Jerry A. Fodor

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-25 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found