in reply to Re^4: How to determine absolute path of current Perl file?
in thread How to determine absolute path of current Perl file?
So using a BEGIN block inside a module to be used it's like to say: as soon as possible or even sooner.
And the only possibility to fail is:#TestBegin.pm use strict; use warnings; BEGIN{print "inside BEGIN in the module ",__FILE__,"\n"} print "in the module ",__FILE__,"\n"; 1; perl -e "print qq(in the program $0\n);BEGIN{print qq(BEGIN in the pr +ogram $0\n)}" -MTestBegin inside BEGIN in the module TestBegin.pm in the module TestBegin.pm BEGIN in the program -e in the program -e
perl -e "print qq(in the program $0\n);BEGIN{print qq(BEGIN in the pr +ogram\n)}use TestBegin;" BEGIN in the program inside BEGIN in the module TestBegin.pm in the module TestBegin.pm in the program -e
L*
|
|---|