Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Object loading at runtimeby mugwumpjism (Hermit) |
on Jun 16, 2005 at 21:31 UTC ( [id://467450]=note: print w/replies, xml ) | Need Help?? |
There isn't much of a penalty on eval STRING when it's a simple statement like use. Not compared to the time it takes to load the module! :) You can always use require, but you first have to perform a transform on the module name (this is a design bug which is tidied in Perl 6):
There will be a cargo cult disapproving of require, be sure to poke your tongue out at them, laugh and ask them why until they say "'coz" :-). You can also look at Class::Tangram::Generator for an example of code that defers loading of modules until objects of the relevant type are created, using several different mechanisms.
In Section
Seekers of Perl Wisdom
|
|