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.