Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Sending variables to subs

by amphiplex (Monk)
on Jun 29, 2002 at 10:44 UTC ( [id://178225]=note: print w/replies, xml ) Need Help??


in reply to Sending variables to subs

Another way to easily access form parameters when using CGI.pm is to use import_names.

For example:
.... use CGI; my $q = new CGI; $q->import_names('Q'); .... inerror("we couldn't find $Q::home, please check path");

From "perldoc CGI":
IMPORTING ALL PARAMETERS INTO A NAMESPACE: $query->import_names('R'); This creates a series of variables in the 'R' namespace. For example, $R::foo, @R:foo. For keyword lists, a vari­ able @R::keywords will appear. If no namespace is given, this method will assume 'Q'. WARNING: don't import any­ thing into 'main'; this is a major security risk!!!! In older versions, this method was called import(). As of version 2.20, this name has been removed completely to avoid conflict with the built-in Perl module import opera­ tor.

----- kurt

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-25 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found