Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I tested this out and it doesn't seem to be working very well. It looks as though the perl interpreter scans the code for "use" statements and loads whatever modules they request before it executes the rest of the code (e.g. the if statement). So whichever the module used is whichever ends up closer to the front in @INC.my $version = '7.54beta1'; #if this were production, it would simply b +e '7.54' if ($version =~ /beta/){ use lib('/path/to/development/copies/of/modules'); } else { use lib('/path/to/production/copies/of/modules'); } use module1; use module2; use module3; #etc
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dynamic "use lib"
by dragonchild (Archbishop) on May 21, 2004 at 16:16 UTC | |
by samtregar (Abbot) on May 21, 2004 at 17:00 UTC | |
by Anonymous Monk on May 21, 2004 at 18:30 UTC | |
by dragonchild (Archbishop) on May 21, 2004 at 17:26 UTC | |
by samtregar (Abbot) on May 21, 2004 at 17:33 UTC | |
|
Re: Dynamic "use lib"
by LTjake (Prior) on May 21, 2004 at 18:48 UTC | |
|
Re: Dynamic "use lib"
by dimar (Curate) on May 21, 2004 at 17:42 UTC |