in reply to Dynamic "use lib"
I have always disliked using BEGIN blocks to achieve dynamic module inclusion. As a workaround, the 'do' command has been useful for me, in combination with 'do-included' files to achieve this kind of functionality. It has worked for me, but I've never seen anyone else use this approach, not sure what you can conclude from that.
BENEFITS:
HASSLES:
foo_main_script.pl
my $sMode = 'beta'; ### 'beta' or 'prod' do"/path/to/scripts/".$sMode."_modules.pl"; ### insert script code here
beta_modules.pl
use lib '/path/to/dev/modules'; use module1; use module2; use module3;
prod_modules.pl
use lib '/path/to/prod/modules'; use module1; use module2; use module3;
|
|---|