You basically have two options:
my $perl_module; BEGIN {$perl_module = shift}; eval "use $perl_module";
(my $filename = "$perl_module.pm") =~ s#::#/#g; require $filename; $perl_module->import;
The first has the disadvantage that you need to eval a string. If you can't trust the parameter input, that may be a security issue.
The latter has the disadvantage that you must convert the module name to a filename. But you need the original module name to be able to do the import().
Hope this helps.
Liz
In reply to Re: module location
by liz
in thread module location
by hmerrill
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |