I have two different versions of a Perl module. Currently, the crucial script uses the version of the module specified by an environment variable and the system relied on different tasks being run by different users. The user's environment would determine which version of the Perl module was used.
Now I would like to change this to the version being specified inside the Perl script, i.e. depending on the options passed. Unfortunately, code like this:
if ($new){ use lib "newdir"; }
else{ use lib "olddir"; }
use module;
doesn't work. Perl simply appends newdir and then olddir to @INC
and then runs the script.
How do I dynamically specify which module to use?