On 08/07/2007 10:18 AM, Fermín Galán Márquez wrote:
Hi!
I'm trying to introduce conditional module loading in a Perl program,
but I'm experiencing problems. For example:
[...]
"Use" is done at compile-time, so both modules will have been loaded
before the if statement is executed. When you wish to load modules at
run-time, use "require", e.g.:
if ($some_condition) {
require ModuleA;
ModuleA->import;
(doing something using ModuleA)
}
else {
require ModuleB;
ModuleB->import;
(doing something using ModuleB)
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/