Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > #!perl instead of #!/usr/bin/perl on a Unix/Apache webserver

Reply
Thread Tools

#!perl instead of #!/usr/bin/perl on a Unix/Apache webserver

 
 
joe
Guest
Posts: n/a
 
      11-13-2003
Hi there!

Can anyone help me out here. I run my CGI-scripts locally on a Windows
machine. In the shebang line I put #!c:\www\Perl.exe, but it's also possible
to use only #!perl. On my virtual webserver at my ISP's Unix machine I have
to use #!/usr/bin/perl.

The problem is that everytime I upload a script, I have to change the
shebang line from Windows-mode to Unix-mode.

Since the #!perl version sounds pretty universal, I was wondering whether it
is possible to make some sort of link: when 'perl' is requested, Apache
redirects to #!/usr/bin/perl. Or something else to accomplish the same
effect. My ISP doesn't know how to do this, without having to move the
Perl-module completely.

I'd be very gratefull if anyone could help me out!

Tia,

Joe


 
Reply With Quote
 
 
 
 
James Willmore
Guest
Posts: n/a
 
      11-13-2003
On Thu, 13 Nov 2003 11:54:46 GMT
"joe" <> wrote:

> Hi there!
>
> Can anyone help me out here. I run my CGI-scripts locally on a
> Windows machine. In the shebang line I put #!c:\www\Perl.exe, but
> it's also possible to use only #!perl. On my virtual webserver at my
> ISP's Unix machine I have to use #!/usr/bin/perl.
>
> The problem is that everytime I upload a script, I have to change
> the shebang line from Windows-mode to Unix-mode.
>
> Since the #!perl version sounds pretty universal, I was wondering
> whether it is possible to make some sort of link: when 'perl' is
> requested, Apache redirects to #!/usr/bin/perl. Or something else to
> accomplish the same effect. My ISP doesn't know how to do this,
> without having to move the Perl-module completely.
>
> I'd be very gratefull if anyone could help me out!


One work-around *might* be to put the *NIX shebang in the script and
executing on Windows by simply putting 'perl' in front of the script
(like "c:\perl\bin\perl.exe script.pl"). This won't work too well
through the web server running on Windows, but it *should* work at the
command line.

Or, you could create a link on the Windows PC. Make the directory
structure 'c:\usr\bin' and place the link there pointing to where Perl
really is on your system. Perl will understand, AFAIK. The '\' can
be '/' on a Windows system in Perl - FWIU.

OTOH, I could be wrong about this and hope someone would correct me if
I am.

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
Authors (and perhaps columnists) eventually rise to the top of
whatever depths they were once able to plumb. -- Stanley
Kaufman
 
Reply With Quote
 
 
 
 
Josef Möllers
Guest
Posts: n/a
 
      11-13-2003
joe wrote:
>
> Hi there!
>
> Can anyone help me out here. I run my CGI-scripts locally on a Windows
> machine. In the shebang line I put #!c:\www\Perl.exe, but it's also possible
> to use only #!perl. On my virtual webserver at my ISP's Unix machine I have
> to use #!/usr/bin/perl.


AFAIK it is irrelevant _what_ command you put into the shebang line on a
windows system. Windows doesn't know shebang lines (it maybe knows a .pl
extension, though), but the perl interpreter knows how to extract
options (e.g. -w) from the shebang line.

So, you might be able to put the Linux/UN*X command into the shebang
line on a Windows system an that would work.

--
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
 
Reply With Quote
 
joe
Guest
Posts: n/a
 
      11-13-2003
Thanks for your input. Because of James' post I realised that I could
install Perl at the exact same address as on my ISP's webserver. I didn't
realise that #!c:\usr\bin\perl.exe is interpreted the same as
#!/usr/bin/perl on a Windows machine. Fortunately it is!

Thanks again!

Joe


 
Reply With Quote
 
Bob X
Guest
Posts: n/a
 
      11-14-2003

"Josef Möllers" <> wrote in message
news:...
joe wrote:
>
> Hi there!
>
> Can anyone help me out here. I run my CGI-scripts locally on a Windows
> machine. In the shebang line I put #!c:\www\Perl.exe, but it's also

possible
> to use only #!perl. On my virtual webserver at my ISP's Unix machine I

have
> to use #!/usr/bin/perl.


>AFAIK it is irrelevant _what_ command you put into the shebang line on a
>windows system. Windows doesn't know shebang lines (it maybe knows a .pl
>extension, though), but the perl interpreter knows how to extract
>options (e.g. -w) from the shebang line.


Actually if you are going to doing web work on Windows then the #!perl is
necessary.


 
Reply With Quote
 
Sam Holden
Guest
Posts: n/a
 
      11-14-2003
On Fri, 14 Nov 2003 02:39:54 GMT, Bob X <> wrote:
>
> "Josef Möllers" <> wrote in message
> news:...
> joe wrote:
>>
>> Hi there!
>>
>> Can anyone help me out here. I run my CGI-scripts locally on a Windows
>> machine. In the shebang line I put #!c:\www\Perl.exe, but it's also

> possible
>> to use only #!perl. On my virtual webserver at my ISP's Unix machine I

> have
>> to use #!/usr/bin/perl.

>
>>AFAIK it is irrelevant _what_ command you put into the shebang line on a
>>windows system. Windows doesn't know shebang lines (it maybe knows a .pl
>>extension, though), but the perl interpreter knows how to extract
>>options (e.g. -w) from the shebang line.

>
> Actually if you are going to doing web work on Windows then the #!perl is
> necessary.


No it isn't. Some web servers may require that, but that's the web server
not windows.

--
Sam Holden
 
Reply With Quote
 
Louis Erickson
Guest
Posts: n/a
 
      11-14-2003
Sam Holden <> wrote:
: On Fri, 14 Nov 2003 02:39:54 GMT, Bob X <> wrote:
:> "Josef Mollers" <> wrote in message
:> news:...
:> joe wrote:
:>>
:>> Can anyone help me out here. I run my CGI-scripts locally on a Windows
:>> machine. In the shebang line I put #!c:\www\Perl.exe, but it's also
:> possible
:>> to use only #!perl. On my virtual webserver at my ISP's Unix machine I
:> have
:>> to use #!/usr/bin/perl.
:>
:>>AFAIK it is irrelevant _what_ command you put into the shebang line on a
:>>windows system. Windows doesn't know shebang lines (it maybe knows a .pl
:>>extension, though), but the perl interpreter knows how to extract
:>>options (e.g. -w) from the shebang line.
:>
:> Actually if you are going to doing web work on Windows then the #!perl is
:> necessary.

: No it isn't. Some web servers may require that, but that's the web server
: not windows.

And, sometimes it varies even within the same web server.

Apache for Windows, for instance, has a way to associate Perl with AS Perl
that doesn't depend on #! pointing anywhere in particular. But, if you
use FastCGI, the #! must be correct.

IIS uses a static mapping of program or ISAPI DLL to extension, so .pl
and .plx are always handled by ActiveState Perl.

Note that Apache's mapping of .pl files and IIS's mapping of .pl files
are entirely different. IIS uses it's own configuration via the IIS MMC,
and Apache uses a registry entry. Or maybe a different registry entry,
depending on your configuration.

Isn't CGI fun?
--
Louis Erickson - - http://www.rdwarf.com/~wwonko/

If you're not part of the solution, you're part of the precipitate.
 
Reply With Quote
 
Bob X
Guest
Posts: n/a
 
      11-14-2003

"Louis Erickson" <> wrote in message
news:bp1keo$kbb$...
> Sam Holden <> wrote:
> : On Fri, 14 Nov 2003 02:39:54 GMT, Bob X <> wrote:
> :> "Josef Mollers" <> wrote in message
> :> news:...
> :> joe wrote:
> :>>
> :>> Can anyone help me out here. I run my CGI-scripts locally on a Windows
> :>> machine. In the shebang line I put #!c:\www\Perl.exe, but it's also
> :> possible
> :>> to use only #!perl. On my virtual webserver at my ISP's Unix machine I
> :> have
> :>> to use #!/usr/bin/perl.
> :>
> :>>AFAIK it is irrelevant _what_ command you put into the shebang line on

a
> :>>windows system. Windows doesn't know shebang lines (it maybe knows a

..pl
> :>>extension, though), but the perl interpreter knows how to extract
> :>>options (e.g. -w) from the shebang line.
> :>
> :> Actually if you are going to doing web work on Windows then the #!perl

is
> :> necessary.
>
> : No it isn't. Some web servers may require that, but that's the web

server
> : not windows.
>
> And, sometimes it varies even within the same web server.
>
> Apache for Windows, for instance, has a way to associate Perl with AS Perl
> that doesn't depend on #! pointing anywhere in particular. But, if you
> use FastCGI, the #! must be correct.
>
> IIS uses a static mapping of program or ISAPI DLL to extension, so .pl
> and .plx are always handled by ActiveState Perl.
>
> Note that Apache's mapping of .pl files and IIS's mapping of .pl files
> are entirely different. IIS uses it's own configuration via the IIS MMC,
> and Apache uses a registry entry. Or maybe a different registry entry,
> depending on your configuration.
>
> Isn't CGI fun?
> --
> Louis Erickson - - http://www.rdwarf.com/~wwonko/
>
> If you're not part of the solution, you're part of the precipitate.

I am using Apache on Windows and I have to use the #!perl shebang. Then
again I may not have Apache setup right.

Didn't mean to imply that anything was wrong with the OS though (per a
previous poster).


 
Reply With Quote
 
Matthias Weckman
Guest
Posts: n/a
 
      11-14-2003
Bob X wrote:
> "Louis Erickson" <> wrote in message
> news:bp1keo$kbb$...
>
>>Sam Holden <> wrote:
>>: On Fri, 14 Nov 2003 02:39:54 GMT, Bob X <> wrote:
>>:> "Josef Mollers" <> wrote in message
>>:> news:...
>>:> joe wrote:
>>:>>
>>:>> Can anyone help me out here. I run my CGI-scripts locally on a Windows
>>:>> machine. In the shebang line I put #!c:\www\Perl.exe, but it's also
>>:>> possible
>>:>> to use only #!perl. On my virtual webserver at my ISP's Unix machine I
>>:>> have
>>:>> to use #!/usr/bin/perl.
>>:>
>>:>>AFAIK it is irrelevant _what_ command you put into the shebang line on

> a
>>:>>windows system. Windows doesn't know shebang lines (it maybe knows a

> .pl
>>:>>extension, though), but the perl interpreter knows how to extract
>>:>>options (e.g. -w) from the shebang line.
>>:>


[snip]

> I am using Apache on Windows and I have to use the #!perl shebang. Then
> again I may not have Apache setup right.
>
> Didn't mean to imply that anything was wrong with the OS though (per a
> previous poster).


I'm using apache too (on my win32 machine for testing), and have this
line in my httpd.conf:

ScriptInterpreterSource Registry

This way apache doesn't need a perfectly written #! line, since it looks
up the association in the windows registry.
The upside of this is that you can put the #! line as needed by your
real web server, and still have a working script in your test environment.
The downside of this is that you have to put every extension you use in
the registry (.cgi isn't by default associated with perl.exe).
In both cases the perl interpreter honors the switches in the shebang
line, so that's nice.

Matthias
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What files to upload to webserver? James Walker ASP .Net 1 07-31-2004 05:11 AM
Forbidden Message, when accessing .pl files from Java Webserver Murari Perl 3 04-06-2004 05:38 PM
Micro Webserver Fred Atkinson Cisco 0 02-13-2004 11:37 PM
Force Ip Address to webserver Travis Best Cisco 2 12-13-2003 07:04 AM
PIX 515E and Windows Webserver w/ multiple IPs on single NIC Gilbert T. Gutierrez, Jr. Cisco 0 10-21-2003 10:41 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57