in reply to Re^3: When C<use Module;> *not* the same as C<require Module; import Module;>?
in thread When C<use Module;> *not* the same as C<require Module; import Module;>?
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().
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: When C<use Module;> *not* the same as C<require Module; import Module;>?
by itub (Priest) on Jan 08, 2005 at 17:25 UTC | |
by BrowserUk (Patriarch) on Jan 08, 2005 at 18:12 UTC | |
by chromatic (Archbishop) on Jan 08, 2005 at 20:58 UTC | |
by itub (Priest) on Jan 08, 2005 at 23:25 UTC | |
by BrowserUk (Patriarch) on Jan 08, 2005 at 23:48 UTC | |
by adrianh (Chancellor) on Jul 26, 2005 at 17:53 UTC | |
|
Re^5: When C<use Module;> *not* the same as C<require Module; import Module;>?
by Mr. Muskrat (Canon) on Jan 08, 2005 at 17:12 UTC |