eval "use $module" is pretty simple if you're 100% confident that the $module variable contains a safe package name. (You want to be sure that it doesn't contain something like "strict; system('rm -fr /home')"!)
Module::Runtime and Class::Load provide somewhat safer techniques if you're less sure about the contents of the variable (e.g. the variable came from the outside world).
In reply to Re: require & import $module_name
by tobyink
in thread require & import $module_name
by temporal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |