In "script1.pl" I have a global object variable:
my $startup = new Startup($dir);
In "module.pm" I want to use variable $startup. I have strict declaration enabled. How to do this?
It's considered bad form for a module to poke about in it's calling script's namespace. You would be better having a function exported from module.pm which sets it's own copy of $startup or pass it as an argument on the [tt]use[/tt] line.
Yours,
fish
["]As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.["]
--Maur
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.