![]() |
|
Just another Perl shrine | |
PerlMonks |
Re: many files one log fileby Eliya (Vicar) |
on Dec 04, 2013 at 00:49 UTC ( #1065514=note: print w/replies, xml ) | Need Help?? |
I think one problem is the libraries are loaded before the variables are made available but putting them in BEGIN breaks stuff. I wonder what exactly you have tried, and how BEGIN did break stuff. As you suspected, initialising the variables in a BEGIN block should work to get the values passed to the lib. A heavily simplified snippet might help ($foo represents $LOGFH etc. that you want to pass to the lib):
with License.pm being
should print "foo = bar" when the main program is being run. Note that $foo has to be declared outside of the BEGIN { }, because the latter implies an extra block scope. Another way would be to use require instead of use and call the import method explicitly:
In this case, the three statements would be executed at runtime in the sequence they appear, so $foo would be properly initialised before the import method is being called.
In Section
Seekers of Perl Wisdom
|
|