Just another Perl shrine | |
PerlMonks |
Re: import() when require-d module name is variableby f00li5h (Chaplain) |
on Jul 18, 2009 at 22:15 UTC ( [id://781385]=note: print w/replies, xml ) | Need Help?? |
eval qq{ use $module_name }; die "can't $module_name because: $@"; Then perl does all the "finding it" magic ... and you still get to decide the module name at run time... You could also loop over many alternate modules and ignore failures until you find one you want, but for that you might want Module::Find or similar too ...
Although here my modules are pure OO, so they don't get imported @_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;
In Section
Seekers of Perl Wisdom
|
|