theatrus has asked for the wisdom of the Perl Monks concerning the following question:
I'm attempting to create a module which loads a Perl module by name. So a database has a list of modules by a more friendly name, and a script calls the loader function to load the actual module and return an object. Example of what I'm trying to do:
sub load($module) {
if ($nett_load_hash$module == 0) {
use vars qw($module);
$nett_load_hash$module = 1;
}
return $module->new();
}
Obviously, it doesn't work at the 'return' part. How would I do this? PHP works nicely by loading "modules" ($module = new $name). Anything like this in Perl?
Originally posted as a Categorized Question.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Loading modules by external data (i.e., database)
by Corion (Patriarch) on Jun 04, 2000 at 14:22 UTC | |
by Anonymous Monk on Jun 07, 2000 at 21:06 UTC | |
Re: Loading modules by external data (i.e., database)
by chromatic (Archbishop) on Jun 06, 2000 at 03:31 UTC |
Back to
Seekers of Perl Wisdom