What happens if you turn import into what's obviously a method call (if you already have an import symbol in your current package, you may have trouble) and use a named lexical?
use Symbol 'delete_package'; foreach my $module (@modules) { require "sub/$module.pm"; $module->import(qw(foo bar)); foo(); bar(); # cleanup delete_package($module); }
Improve your skills with Modern Perl: the free book.
In reply to Re: require & import $module_name
by chromatic
in thread require & import $module_name
by temporal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |