In perl we can do:
use lib LIST;
include a list of paths in @INC. Similarly, we can do:
use if CONDITION, MODULE => ARGUMENTS;
to enable the module conditionally.
Is it possible to make a combination of both, something like
use lib if CONDITION, LIST;
include a conditional list of paths. This does not work.
Edit: Sorry, but I still can't get it to work. This is what I do, but not work. Could you suggest what is wrong?
use Data::Dumper; BEGIN { my $env=$ENV{'ENV'}; use if $env eq 'OLD', lib => '/home/vivek/OLD'; use if $env eq 'NEW', lib => '/home/vivek/NEW'; } print Dumper \@INC;
Vivek source share