cadphile has asked for the wisdom of the Perl Monks concerning the following question:
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: use/require $MODULE (a variable)
by Zaxo (Archbishop) on Mar 16, 2002 at 02:54 UTC | |
by brainbuz (Novice) on Feb 11, 2010 at 07:28 UTC | |
by afoken (Chancellor) on Feb 11, 2010 at 19:03 UTC | |
|
Re: use/require $MODULE (a variable)
by lestrrat (Deacon) on Mar 16, 2002 at 03:52 UTC | |
by cadphile (Beadle) on Mar 17, 2002 at 03:11 UTC | |
by lestrrat (Deacon) on Mar 17, 2002 at 04:58 UTC | |
by cadphile (Beadle) on Mar 18, 2002 at 08:08 UTC | |
by lestrrat (Deacon) on Mar 18, 2002 at 08:26 UTC | |
| |
by cadphile (Beadle) on Mar 17, 2002 at 04:47 UTC | |
|
Re: use/require $MODULE (a variable)
by erikharrison (Deacon) on Mar 16, 2002 at 03:03 UTC |