|
|
| Perl Monk, Perl Meditation | |
| PerlMonks |
Re^4: When C<use Module;> *not* the same as C<require Module; import Module;>?by BrowserUk (Patriarch) |
| on Jan 08, 2005 at 11:53 UTC ( [id://420545]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
You forgot to wrap in BEGIN {} No, that was deliberate. There would be no point in not using use if I did. The whole point is to defer the loading of the module until and if it is needed. As constants are subs, and Perl allows you to call a sub that hasn't been declared yet, it is possible to use the constants in your code prior to them having been loaded. The bit I was missing, as merlyn pointed out above, is that it won't be recognised as a constant sub without having been previously declared or, I use the brackets(). Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||||