How do I ignore the Perl shebang on Windows with A

2019-01-09 04:01发布

I have set up a local Perl web environment on my Windows machine. The application I'm working on is originally from a Linux server, and so the shebang for source .pl files look like so:

#!/usr/bin/perl

This causes the following error on my Windows dev machine:

(OS 2)The system cannot find the file specified.

Is it possible to change my Apache 2 conf so that the shebang is ignored on my Windows machine? Of course I could set the shebang to #!c:\perl\bin\perl.exe, that much is obvious; but the problem comes to deploying the updated files. Clearly it would be very inconvenient to change this back on each deploy. I am using ActivePerl on Windows 7.

Update:

I should have mentioned that I need to keep the shebang so that the scripts will work on our shared hosting Linux production server. If I did not have this constraint and I didn't have to use the shebang, the obvious answer would be to just not use it.

7条回答
Bombasti
2楼-- · 2019-01-09 05:06

In win7 and up you can also do this with the "dos" command mklink.

Start a cmd shell as administrator and do something like the following:

mklink /d c:\usr c:\Perl       # Activestate perl in c:\Perl\bin\perl.exe
mklink /d c:\usr c:\xampp\perl # Xampp perl in c:\xampp\perl\bin\perl.exe
查看更多
登录 后发表回答