in reply to How to specify a specific Module::subroutine as command option
If you go this approach you should understand the basics of Perl's OO support. You should definitely understand bless, have read perltoot, etc.# Takes a package name, loads the associated module. sub load_module { my $pkg = shift; my $file = $pkg; $file =~ s/::/\//g; $file .= ".pm"; require $file; } # Then at the start of your code, assuming you already # processed the module_name into $module load_module($module); my $parser = $module->new(); # Proceed...
|
|---|