Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
By declaring $oui_location with my, you've made it lexically scoped and unavailable to your other packages. There are a variety of strategies to deal with this. This simplest is to change package OUILookup:
When other code references this variable, simply refer to it with a fully qualified package name. However, global variables are usually a bad idea. You could use Exporter:
Then, in package main, I have the following:
That will print "Hello" instead of 7. My suggestion, though, would be to create a set_oui_lookup() sub in your module. That's the cleanest solution. Cheers, Vote for paco! Join the Perlmonks Setiathome Group or just click on the the link and check out our stats. In reply to (Ovid) Re: Allowing user to change module variables
by Ovid
|
|