Is possible to use different version of Perl without using the SET or manipulating the environment variable “PATH”
I need a mechanism that allows me to work with different version of Perl for different script without affecting the system configuration.
(e.g. I am using Perl ver 5.6.1 for some scripts and perl 5.8.8 for other Perl scripts)
It’s an old trick I do when I have two different, but very incompatible versions of Perl I have to use: Use different suffixes:
For example, I have ClearQuest on my system and must use
cqperl(which is ClearQuest’s version of Perl) to execute scripts that manipulate the issues in ClearQuest. Yet, if I have to manipulate SQL data from our database, I have to use my ActivePerl because I can’t add in theDBImodule intocqperl.What I did was associate the
*.plsuffix with ActivePerl and the*.cqplsuffix withcqperl. Now, when I execute a script, and it ends in*.cqpl, it uses one version of Perl while a script that ends with*.plis executed by another version of Perl.To associate a suffix with a program, go into a Windows Explorer window and select Folder Options from the Tools menu. Then, click on the File Types tab. Click on the New button and create a new extention to associate with the file. Then, select it in the Registered File Types window, and click on the Advanced button on the bottom.
Create an
Openaction, and associate it with the full path name of the Perl you want to execute that suffix. Like this:The
%*is important, so you can pass other parameters to your program.In your case, you could use
*.plfor Perl 5.8.8 and*.pl6for Perl 5.6.You don’t even need to put Perl’s
bindirectory in your path. Just type the name of your script and that’s it.