How do I dynamically change the Perl module path? -
I have two different versions of the pell module. Currently, the important script uses the version of the module specified by the environment variable and the system depends on the various functions being run by different users. The user's environment will determine which version of the Pearl module was used. Now I want to change it in the version specified in the Perl script, i.e. depending on the options passed. Unfortunately, code like this: if ($ new) {lib "newdir" use; } Other {use "old"; } Use Module; does not work, Pearl simply adds newdir and olddir to @INC and then runs the script is. How do I specify a dynamic mode to use? You must use a BEGIN {} block of your If - other code will be executed at compile time: BEGIN {if ($ new) {unshift @INC, "newdir"; } Else {unshift @INC, "old" ;; }} Usage module; You can also set environment variables so that you do not have to do this type of configuration in...