At 03:59 PM 9/1/2001 -0400, Brett W. McCoy wrote:
>On Fri, 31 Aug 2001, Shannon Murdoch wrote:
>
> > Is there any way (I'm sure there is) to make my perl scripts run with the
> > standard unix shebang instead?
>
>Yes, use Unix. :-)

So helpful for the Operating System "challenged". :)

>If you are usig ActiveState, you have to use the Windows way of using
>pathnames.  If you are using CygWin (which is a POSIX emulation layer for
>Win32), you can use the Unix-style shebang line with CygWin's version of
>Perl.

Brett, are you sure that this is the end of the story?

The parsing of the shebang line is not purely a function of the Operating 
System layer (as you suggest using CygWin) but is also a function of Apache 
(specificially on Win32). I have tried and was successful with the 
following technique 3 years ago, but I do not know whether such a technique 
will still work.

The premise is that Apache (on Win32 -- this is a special feature of Win32 
Apache) already understands #!c:\perl\bin\perl.exe. It's actually a *really 
nice* feature because it allows you to enable warnings and taintmode 
without mucking about with the the file association registry stuff -- I 
could go off on a soapbox now about this but I won't.

But, when I experimented with different things I found that Apache could 
interpret and understand by itself, the following things in Win32:

a) #!c:\perl\bin\perl

Taking of .exe works

b) #!c:/perl/bin/perl

switching the backslashes representation works.

c) and a final experiment

#!/perl/bin/perl

Shows that Apache understood that it was also installed on the C: drive and 
therefore did not need the pointer to let it know to find Perl there.

So this would lead us to figuring that #!/perl/bin/perl could be made to 
look like /usr/bin/perl. How? Easy enough I think.

I basically installed Perl into c:\usr instead of c:\perl so that bin was 
under c:\usr\bin.

And that worked for me.

I can't say if this still works but if Apache is doing the interpretation I 
don't see why not. Note that this is an Apache feature -- this won't help 
you with brain dead web servers like IIS that make it really hard to set up 
CGI/Perl. But since the question was specifically about Win32 Apache, I've 
obliged to talk about it.

One other note is that rather than going through another ActiveState Perl 
install into \usr, I think that you can simply make a copy of perl.exe in 
c:\usr\bin\ and keep your perl distro where it is as the registry or some 
other setting in windows actually knows that the Perl distro for that 
binary is in c:\perl and so this technique can be tried out in an even 
*easier* fashion than my first suggestion.

Shannon, if you would be so kind, I would be interested to know this 
technique still works if you end up trying it.

Good Luck,
               Gunther



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to