The PmLoader will parse the module name, and a version number (if it exists) for that module. Otherwise, it will query our system to see if there is a "current" version for this modulename, and use it. Now these funny modules may be located in paths down from /net/public/tools/perl/lib that may contain the version number in the path, or the module name as a parent directory, in a known set of subdirectories. (These are the result of many years of haphazard development and installation methods.) For example:# This is the location where the loader module will be # picked up. use lib qw( /net/public/tools/perl/lib ); use PmLoader qw( MyFunnyModule :1.5 someoldpackage.pl Some::Hierarchical::Module :2.1 );
But basically, after the PmLoader.pm module has found each of the correct modules (or .pl files), and pushed that path on @INC, I then need to load the module. So here's the rub: I need to do this:/net/public/tools/perl/lib/MyFunnyModule/<version>/MyFunnyModule.pm /net/public/tools/perl/lib/MyFunnyModule/MyFunnyModule.pm,<version> /net/public/tools/perl/lib/pl-libs/someoldpackage.pl
Perl really doesn't like that variable name however in the BEGIN require block!! First of all, the variable $module set in the PmLoader sub import routine, isn't visible to the BEGIN{} block. And secondly, even if it was, I don't think it like seeing a variable there. What's the solution to loading module names that exist in variables?? -CadphileBEGIN { require $module; }
In reply to use/require $MODULE (a variable) by cadphile
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |