Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Sending variables to subs

by amphiplex (Monk)
on Jun 29, 2002 at 10:44 UTC ( #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? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2022-09-27 20:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (124 votes). Check out past polls.

    Notices?