in reply to BEGIN vs initialization
Your questions don't make sense because there's no initialisation in Perl in the sense that you're picturing. Here's what you are missing:
- "=" doesn't denote an initialiser in Perl. It's always just a normal assignment.
- BEGIN blocks are executed as soon as they are compiled.
- use Module; is the same as BEGIN { require Module; import Module; }.
- Using require to load a file simply runs it as any other script (if it's not already loaded). It is both compiled and executed.
Taking a simplified version of your code
#main.pl use Gbl; BEGIN{ $Gbl::runContext = $Gbl::runSMTP; } ...
# GBL.pm package Gbl; our $runSMTP = 2 1;
Let's apply what I've said above to determine the order in which everything is executed
main.pl | ||
|
|
---|
In Section
Seekers of Perl Wisdom