Perl-Sensitive Sunglasses | |
PerlMonks |
Re: use depending on environmentby Xaositect (Friar) |
on Jun 22, 2005 at 15:57 UTC ( [id://469068]=note: print w/replies, xml ) | Need Help?? |
Using a begin block is preferrable if you can get away with it, but if you can't know whether or not you want to load a module at compile-time, try using 'require' instead of 'use'. 'require' will load the module at run-time. ( 'use' is equivilant to BEGIN { require MODULE; } ) In general, 'use' is preferable because it gives the compiler more information about the symbols in your namespace. For example, where you might have done
You can't just substitute require because then the compiler won't know where the "Dumper" function comes from. Instead you have to do something like
Xaositect - Whitepages.com
In Section
Seekers of Perl Wisdom
|
|