Perl Monk, Perl Meditation | |
PerlMonks |
use vs. requireby reneeb (Chaplain) |
on Nov 27, 2007 at 15:05 UTC ( [id://653255]=perlquestion: print w/replies, xml ) | Need Help?? |
reneeb has asked for the wisdom of the Perl Monks concerning the following question: Hi folks, I've got one question: test1.pl:
A.pm:
result:
test2.pl:
result: A::B::new called with args: <A::B test 1>I've search several docs, but haven't found anything that would explain why "use" and a "require" in a BEGIN block have a different behaviour than "require" or a "use"(in a string eval). Why is in one case the subroutine B called (when A is loaded in compile time) and in the other case the subroutine "new" of package A::B is called (when A is loaded in run time)? Cheers,
Back to
Seekers of Perl Wisdom
|
|