in reply to module location
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: module location
by hmerrill (Friar) on Nov 07, 2003 at 15:43 UTC | |
by liz (Monsignor) on Nov 07, 2003 at 15:50 UTC | |
by hmerrill (Friar) on Nov 07, 2003 at 16:23 UTC |