Dear Paul, Mumia,

Thank you for you advice! Now my problem has been solved :)

Regards,

--------------------
Fermín Galán Márquez
CTTC - Centre Tecnològic de Telecomunicacions de Catalunya
Parc Mediterrani de la Tecnologia, Av. del Canal Olímpic s/n, 08860
Castelldefels, Spain
Room 1.02
Tel : +34 93 645 29 12
Fax : +34 93 645 29 01
Email address: fermin dot galan at cttc dot es

Mumia W. escribió:
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/


Reply via email to