There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hello contra-sh, and welcome to the Monastery! I’ll just address one part of your question: Seems like the override only works when I call the function. That's weird because I modified the value before including the logging module. No you didn’t! use logging; is the same as BEGIN { require Module; }, which means that the code in “logging.pm” is loaded and run before the rest of the script begins running (because anything in a BEGIN block is run at compile time). Change that line in “run-unit-tests.pl” to require logging; and the output is:
- Should I see any difference if I use require instead of use? Yes! (as just explained). Hope that helps,
In reply to Re: Seeking the right way to override global variables
by Athanasius
|
|