Re: .pl or shebang
by cdarke (Prior) on May 15, 2009 at 08:05 UTC
|
A few other notes. On Windows it is up to the shell, or application running the program, to get the file extension association from the registry - the OS does not do it (see Win32::FetchCommand). You can get a list of file extension associations on the command-line with: assoc|more
You should see: .pl=Perl. Perl is associated with the perl executable in the registry as well (HKEY_CLASSES_ROOT) You can create a new association on the command-line with (for example):assoc .ppl=Perl
The effect is saved in the registry.
| [reply] [d/l] [select] |
|
|
| [reply] [d/l] |
|
|
| [reply] |
Re: .pl or shebang
by grizzley (Chaplain) on May 15, 2009 at 06:27 UTC
|
Yes, it works exactly as you think: the shebang line is ignored on windows, and script is identified by extension .pl, which is stored in registry and associated to perl executable. | [reply] |
|
|
the shebang line is ignored on windows
Not ignored *completely*. Switches such as '-l', '-w', and '-T', are honoured - and, last time I checked, the shebang line (if present) had to match the string 'perl'.
Cheers, Rob
| [reply] |
|
|
C:\>perl
#!/usr/bin/PYTHON -T --
Can't exec /usr/bin/PYTHON at - line 1.
C:\>
| [reply] [d/l] |
|
|
|
|
"-T" in the file will not work. You have to change the executable path in the registry and add it or call it from the cmdline: "perl -T foo.pl"
| [reply] |
|
|
|
|
|
Re: .pl or shebang
by wol (Hermit) on May 15, 2009 at 10:26 UTC
|
I am using activeperl 5.6.1 on MSWin32
You have my sympathy - I too am labouring under this restriction. :-(
--
use JAPH;
print JAPH::asString();
| [reply] |
Re: .pl or shebang (.bat)
by tye (Sage) on May 16, 2009 at 06:28 UTC
|
I don't think you should have to know what language a tool is implemented in just to use the tool. So I don't like to launch perl scripts via "perl script ..." nor "script.pl ...". On Windows, I prefer to use pl2bat which turns your Perl script into a *.bat file that can be run without jumping through configuration hoops.
| [reply] |
|
|
| [reply] |
|
|
I use pl2bat too. Can't say I like it though. :)
I use it for the reason mentioned by tye and because I need pipelines and file
redirection to work, and last time I looked these two were badly broken by file
associations, as documented at
Perl 5.8.9 pl2bat doco
(see the "ADVANTAGES" section).
| [reply] |
|
|
|
|
|
|
I would not call associating .pl with perl.exe and adding .pl into PATHEXT "hoops". I would not want to jump through the pl2bat hoop every time I create a script or update the not-mangled instance of the script. Especially since the Perl installation (at least ActiveState, but I bet others as well) does at least the association.
Jenda
Enoch was right!
Enjoy the last years of Rome.
| [reply] |