Regarding compilation time-vs-run-time:
In Perl, modules (packages / namespaces) usually live in separate files. That is, Some::Module can be found in Some / Module.pm. In this setting, the difference in compilation time vs-run-time will not make much difference. The runtime of the module loaded using use() will be until the call code is compiled. Observer:
File Some/Module.pm :
package Some::Module; BEGIN{ print "Some::Module - compile time\n" } print "Some::Module - run time\n"; 1;
File test.pl :
BEGIN{ print "Just started compiling the program.\n" } use Some::Module; BEGIN{ print "main - compile time\n" } print "main - run time\n";
The output will be:
Just started compiling the program. Some::Module - compile time Some::Module - run time main - compile time main - run time
Therefore, before compilation of your main program will continue after loading the module, our @ISA = qw(Base); .
It is true, however, that assigning @ISA does not guarantee that the base class has been loaded. That is why we have the use base and use parent pragmas. If you do not need any use base functions (fields) and do not need the longer backward compatibility that it provides in use parent , I suggest you use the lighter use parent .
tsee
source share