Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Scope, package, and 'my' variables

by rtwingfield (Acolyte)
on Jan 05, 2005 at 00:33 UTC ( [id://419472]=note: print w/replies, xml ) Need Help??


in reply to Scope, package, and 'my' variables

You can export symbols from modules by using Exporter(). For example, in the automatically executed BEGIN subroutine, the Exporter will export the subroutine, print_hidden_param_fields and the six vars associated with it. The subroutine can then be called without qualification reference to the used module, and the vars are globaly available without qualification.

BEGIN { use Exporter(); @ISA=qw(Exporter); @EXPORT=qw(&print_hidden_param_fields $host_name $db_name $userid $passwd $table $pkey); } use vars qw($host_name $db_name $userid $passwd $table $pkey);

Take a look at Steven Holzner, "Exporting Symbols from Modules by Default", Perl Black Book, Coriolis Open Press, 1999, p. 846-847.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-19 10:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found