Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

(tye)Re: packages / modules in the same file

by tye (Sage)
on Nov 13, 2001 at 22:02 UTC ( [id://125095]=note: print w/replies, xml ) Need Help??


in reply to packages / modules in the same file

A minor point that probably doesn't matter anymore for this particular project, but that knowing about might save you some time later:

Exporter.pm can't see your lexical variables and so can't export them for you. You'd need to replace "my" with "our" or, better, "use vars" if you wanted to do that.

You can export a lexical by writing your own import() method, but you'd have to export it to a global in the calling package so you can't completely avoid globals when exporting.

Note that you can do something like:

my $var; use My::Package( Import=>\$var ); # or even use ACME::Widget( Import => \my( $widget ) );
to get around that.

        - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-03-19 09:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found