To set this up in Windows there are 2 steps:
1)Setup the association between the .pl extension and an actual program. Search for "associate extension" in Windows Help for the details. Now you will be able to "click on" a Perl program icon to run it.
To view associations from the command line, use the assoc Windows command (or of course use the GUI method above):
2)Next, you need to tell Windows shell that files ending in .pl are executable files. This is needed so that you can type in the name of a Perl file (something.pl) from the command line. This is done via the PATHEXT environment variable. Search for "environment" in Windows Help and look at "Add or change the values of environment variables".C:\Projects>assoc | grep -i perl .perlnet=PerlNET.Project .pl=Perl .pls=PerlScriptFile
To use a different version of Perl to run, at the command line you must type the name of the Perl.exe that you mean, perhaps like: >perlv58 xxx.pl or >perlv510 xxx.pl. I suppose that if you are going to do this a lot, you could set up a .pl58 and a .pl510 file extension for different versions. But, no under Windows, the .pl file itself will not know which Perl interpreter to run.C:\Projects>env | grep EXT PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PSC1;.pl
Oh, I guess you could also make a .bat file that pre-pends the PATH with the path name of the version of Perl that you want to use, that way it will be found first when it sees a .pl file. Also, on Windows you can make different shortcuts to the command line shell with different environment variables. So if you want to work with say Perl 5.10 instead of Perl5.8, you just start a different command line environment.
This is one other bit that you should know...Although the path to Perl is not used under Windows, the flags after it are used. For example: #!/usr/bin/perl -w The -w flag turns on warnings.
So if you are not using multiple versions of Perl under Windows, just associate the .pl extension as shown above. The Windows Perl will ignore the path after #! that you are using under Unix, but will use the switches (like -w or whatever).
This was wordy, but I hope clear enough to understand.
In reply to Re: path to perl install directory
by Marshall
in thread path to perl install directory
by srinikar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |