Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

local bin perl path

3 views
Skip to first unread message

ho...@hope.com

unread,
Jul 5, 2005, 3:17:57 PM7/5/05
to
Hi all

I read some time ago that instead of keep changing the path to perl in the script from
#!/user/local/perl for unix #!c:\perl\bin\perl.exe to use on windows

You could put in a statement some where so you did not have to do this to every dam script
that you have.

BUT at the time I did not think that would be any use to me .

Now having searched and searched with google I cannot find the dam thing


Hope some one can help me


Thanks

Paul Lalli

unread,
Jul 5, 2005, 3:59:37 PM7/5/05
to
ho...@hope.com wrote:
> I read some time ago that instead of keep changing the path to perl in the script from
> #!/user/local/perl for unix #!c:\perl\bin\perl.exe to use on windows
>
> You could put in a statement some where so you did not have to do this to every dam script
> that you have.

You never have to do this. Windows couldn't care less about a shebang.
It doesn't use it. Feel free to leave your shebang as
#!/usr/local/bin/perl
or whatever you use for Perl on your Unix system. Windows will never
notice. Windows only "knows" to use perl.exe to execute .pl files
through its standard file-association methods (ie, go to Tools->File
Types and look for .pl files). The Activestate installer makes this
association for you automatically.

Paul Lalli

A. Sinan Unur

unread,
Jul 5, 2005, 4:06:27 PM7/5/05
to
ho...@hope.com wrote in news:6lmlc1hp610nn6rhr...@4ax.com:

> I read some time ago that instead of keep changing the path to perl in
> the script from #!/user/local/perl for unix #!c:\perl\bin\perl.exe
> to use on windows

As Paul Lalli pointed out, for regular usage, you never have to worry
about this.



> You could put in a statement some where so you did not have to do this
> to every dam script that you have.

If you are going to curse, at least use the correct spelling. Otherwise,
you come across as being very silly.

> Now having searched and searched with google I cannot find the dam
> thing

Well, dams are hard to miss. But your question seems to be an Apache
configuration question in disguise. For that, instead of using Google,
you would be better server by spending a few minutes browsing the Apache
documentation:

<URL:http://httpd.apache.org/docs-
2.0/mod/core.html#scriptinterpretersource>

Sinan

--
A. Sinan Unur <1u...@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

John Bokma

unread,
Jul 5, 2005, 4:23:58 PM7/5/05
to
"Paul Lalli" <mri...@gmail.com> wrote:

> ho...@hope.com wrote:
>> I read some time ago that instead of keep changing the path to perl
>> in the script from #!/user/local/perl for unix
>> #!c:\perl\bin\perl.exe to use on windows
>>
>> You could put in a statement some where so you did not have to do
>> this to every dam script that you have.
>
> You never have to do this. Windows couldn't care less about a
> shebang.

But Apache seems to *do* care.

(Also Windows does use the switches)

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html

A. Sinan Unur

unread,
Jul 5, 2005, 4:43:05 PM7/5/05
to
John Bokma <jo...@castleamber.com> wrote in
news:Xns968A9CA18F...@130.133.1.4:

> "Paul Lalli" <mri...@gmail.com> wrote:
>
>> ho...@hope.com wrote:
>>> I read some time ago that instead of keep changing the path to perl
>>> in the script from #!/user/local/perl for unix
>>> #!c:\perl\bin\perl.exe to use on windows
>>>
>>> You could put in a statement some where so you did not have to do
>>> this to every dam script that you have.
>>
>> You never have to do this. Windows couldn't care less about a
>> shebang.
>
> But Apache seems to *do* care.

The OP did not mention Apache.

> (Also Windows does use the switches)

No, Windows does not care the least bit about the switches on the
shebang line. perl on Windows does.

Gunnar Hjalmarsson

unread,
Jul 5, 2005, 4:46:59 PM7/5/05
to
ho...@hope.com wrote:
> I read some time ago that instead of keep changing the path to perl in the script from
> #!/user/local/perl for unix #!c:\perl\bin\perl.exe to use on windows

Assuming that

1) you are talking about invoking Perl programs as CGI scripts, and

2) the dam Unix shebang line typically is #!/usr/bin/perl

you can simply put a copy of perl.exe in C:\usr\bin

HTH

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

ho...@hope.com

unread,
Jul 6, 2005, 3:45:45 AM7/6/05
to
Oh Oh Oh

Ok this is my fault for all the confusion for not going into more details


1....I'm running WinXp Pro
2....Apache 2
3....Perl
4....PHP

When I run a perl/cgi script from Netscape I have to alter the top part of th script ALL
the time to make it work like

#!/user/local/perl

to

#!c:\perl\bin\perl.exe

All scripts are in the apache cgi-bin folder


>you can simply put a copy of perl.exe in C:\usr\bin

I did not see a folder with the C:\usr\bin

All I had was C:\usr. So I made another folder inside C:\usr so now I had C:\usr\bin

then put the perl.exe file in that

BUT that did not work

Thanks to all for the help so far.

A. Sinan Unur

unread,
Jul 6, 2005, 4:47:20 AM7/6/05
to
ho...@hope.com wrote in news:7q1nc1llq7vvb1boc...@4ax.com:

> Oh Oh Oh

Indeed.

Please do not top-post.

> All I had was C:\usr. So I made another folder inside C:\usr so now
> I had C:\usr\bin
>
> then put the perl.exe file in that
>
> BUT that did not work

Have you read my other response to you?

http://groups-
beta.google.com/group/comp.lang.perl.misc/msg/92fb4b718562b31b

Gunnar Hjalmarsson

unread,
Jul 6, 2005, 6:54:54 AM7/6/05
to
ho...@hope.com wrote:

> Gunnar Hjalmarsson wrote:
>>
>
> When I run a perl/cgi script from Netscape I have to alter the top
> part of th script ALL the time to make it work like
>
> #!/user/local/perl
>
> to
>
> #!c:\perl\bin\perl.exe
>
>> you can simply put a copy of perl.exe in C:\usr\bin

Quoted out of context. I said:

"Assuming that ... the dam Unix shebang line typically is
#!/usr/bin/perl, you can simply put a copy of perl.exe in C:\usr\bin"

> I did not see a folder with the C:\usr\bin
>
> All I had was C:\usr. So I made another folder inside C:\usr so now
> I had C:\usr\bin
>
> then put the perl.exe file in that
>
> BUT that did not work

I thought "#!/user/local/perl" included a couple of typos. If that's not
the case, perl.exe should better be copied to C:\user\local.

See the pattern now? ;-)

A. Sinan Unur

unread,
Jul 6, 2005, 8:22:34 AM7/6/05
to
Gunnar Hjalmarsson <nor...@gunnar.cc> wrote in
news:3j1rk1F...@individual.net:

> ho...@hope.com wrote:
>> Gunnar Hjalmarsson wrote:
>>>
>>
>> When I run a perl/cgi script from Netscape I have to alter the top
>> part of th script ALL the time to make it work like
>>
>> #!/user/local/perl
>>
>> to
>>
>> #!c:\perl\bin\perl.exe
>>
>>> you can simply put a copy of perl.exe in C:\usr\bin
>
> Quoted out of context. I said:
>
> "Assuming that ... the dam Unix shebang line typically is
> #!/usr/bin/perl, you can simply put a copy of perl.exe in C:\usr\bin"
>
>> I did not see a folder with the C:\usr\bin
>>
>> All I had was C:\usr. So I made another folder inside C:\usr so now
>> I had C:\usr\bin
>>
>> then put the perl.exe file in that
>>
>> BUT that did not work
>
> I thought "#!/user/local/perl" included a couple of typos. If that's
> not the case, perl.exe should better be copied to C:\user\local.

Of course, this would work, but I still recommend configuring Apache to
disregard the shebang line, and look for the interpreter in the right
place.

<URL:http://httpd.apache.org/docs-2.0/mod/core.html>

See directive ScriptInterpreterSource.

Here is what I have in the registry:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.pl\Shell\ExecCGI]
"command"="c:\\opt\\perl\\bin\\perl.exe -T \"%1\""

Paul Lalli

unread,
Jul 6, 2005, 8:32:37 AM7/6/05
to
John Bokma wrote:
> "Paul Lalli" <mri...@gmail.com> wrote:
>
> > ho...@hope.com wrote:
> >> I read some time ago that instead of keep changing the path to perl
> >> in the script from #!/user/local/perl for unix
> >> #!c:\perl\bin\perl.exe to use on windows
> >
> > You never have to do this. Windows couldn't care less about a
> > shebang.
>
> But Apache seems to *do* care.
>
> (Also Windows does use the switches)

Others have pointed out the Apache issues. As for switches, it's Perl
that processes them, not Windows. And once Perl is running, it doesn't
care what the path to perl.exe on the shebang was.
#!/usr/bin/perl -w -ni.bkp
will work just as effectively as
#!c:\perl\bin\perl.exe -w -ni.bkp

Paul Lalli

Gunnar Hjalmarsson

unread,
Jul 6, 2005, 9:24:14 AM7/6/05
to
A. Sinan Unur wrote:

> Gunnar Hjalmarsson wrote:
>> I thought "#!/user/local/perl" included a couple of typos. If that's
>> not the case, perl.exe should better be copied to C:\user\local.
>
> Of course, this would work, but I still recommend configuring Apache to
> disregard the shebang line, and look for the interpreter in the right
> place.
>
> <URL:http://httpd.apache.org/docs-2.0/mod/core.html>
>
> See directive ScriptInterpreterSource.
>
> Here is what I have in the registry:
>
> Windows Registry Editor Version 5.00
>
> [HKEY_CLASSES_ROOT\.pl\Shell\ExecCGI]
> "command"="c:\\opt\\perl\\bin\\perl.exe -T \"%1\""

If symlinks could have been created on Windows (they can't, can they?),
I had suggested a symlink instead. However, considering that an extra
instance of perl.exe is much easier to accomplish than 'the right
solution', why do you recommend the latter? Can two instances of
perl.exe lead to problems?

A. Sinan Unur

unread,
Jul 6, 2005, 9:27:54 PM7/6/05
to
Gunnar Hjalmarsson <nor...@gunnar.cc> wrote in
news:3j24c1F...@individual.net:

> A. Sinan Unur wrote:
>> Gunnar Hjalmarsson wrote:
>>> I thought "#!/user/local/perl" included a couple of typos. If that's
>>> not the case, perl.exe should better be copied to C:\user\local.
>>
>> Of course, this would work, but I still recommend configuring Apache
>> to disregard the shebang line, and look for the interpreter in the
>> right place.
>>
>> <URL:http://httpd.apache.org/docs-2.0/mod/core.html>
>>
>> See directive ScriptInterpreterSource.
>>
>> Here is what I have in the registry:
>>
>> Windows Registry Editor Version 5.00
>>
>> [HKEY_CLASSES_ROOT\.pl\Shell\ExecCGI]
>> "command"="c:\\opt\\perl\\bin\\perl.exe -T \"%1\""
>
> If symlinks could have been created on Windows (they can't, can
> they?), I had suggested a symlink instead.

I think there is Cygwin has some kind of symlink emulation. In addition,
I was able to find an interesting discussion of links in Windows at:

<URL:http://shell-shocked.org/article.php?id=284>

> However, considering that an extra instance of perl.exe is much
> easier to accomplish than 'the right solution',

Strictly speaking, I did not call anything 'the right solution'.

> why do you recommend the latter?

I see this as an Apache configuration issue. As such, I prefer to use
that solution.

> Can two instances of perl.exe lead to problems?

I am not aware of any, other than the fact that you need to remember to
keep that copy up-to-date if you upgrade your Perl distribution.

Also, I use Cygwin tools as well, and, although I have no proof of this,
I am thinking having a C:\usr\bin might cause some confusion in Cygwin
Bash.

Gunnar Hjalmarsson

unread,
Jul 6, 2005, 11:50:24 PM7/6/05
to
A. Sinan Unur wrote:
> Gunnar Hjalmarsson wrote:
>> If symlinks could have been created on Windows (they can't, can
>> they?), I had suggested a symlink instead.
>
> I think there is Cygwin has some kind of symlink emulation. In addition,
> I was able to find an interesting discussion of links in Windows at:
>
> <URL:http://shell-shocked.org/article.php?id=284>

Yeah, that *was* interesting. So, I was about as wrong as I could have
been...

Had to try it:
- Downloaded Junction Link Magic from
http://www.rekenwonder.com/linkmagic.htm and installed it.
- Removed my copy of perl.exe and the C:\usr\bin folder, resulting
in a conventional empty C:\usr folder.
- Converted C:\usr to a "junction point" with destination
C:\IndigoPerl\perl using Junction Link Magic.

Seems to work. :)

Joe Smith

unread,
Jul 10, 2005, 7:24:18 AM7/10/05
to
A. Sinan Unur wrote:

> Also, I use Cygwin tools as well, and, although I have no proof of this,
> I am thinking having a C:\usr\bin might cause some confusion in Cygwin
> Bash.

Bash would not confuse one for the other since the naming conventions
are different.

Cygwin programs use '/cygdrive/c/usr/bin' to access 'C:\usr\bin'.
Windows programs use 'C:\cygwin\bin' to access '/usr/bin'.
-Joe

Joe Smith

unread,
Jul 10, 2005, 7:34:23 AM7/10/05
to
Gunnar Hjalmarsson wrote:

> If symlinks could have been created on Windows (they can't, can they?)

Links in Windows is not well documented but does exist.
The way I heard it is that there was a government contract up for
bid which had a requirement that the system be POSIX-1.0 compliant.
MS added just enough functionality to pass that hurdle.
-Joe

Fabian Pilkowski

unread,
Jul 10, 2005, 8:22:46 AM7/10/05
to
* Joe Smith schrieb:

> Gunnar Hjalmarsson wrote:
>
>> If symlinks could have been created on Windows (they can't, can they?)
>
> Links in Windows is not well documented but does exist.

Windows could create "hardlinks" only on NTFS file systems. On my XP
machine there's a command line tool named "fsutil" for this. And, to
stay on topic, Perl's builtin function link() works properly.

I don't know about any way to create "symlinks" (or "softlinks") on
windowish systems (but perhaps it's just me who don't know about).

regards,
fabian

A. Sinan Unur

unread,
Jul 10, 2005, 9:22:35 AM7/10/05
to
Joe Smith <j...@inwap.com> wrote in
news:0_KdnUt5Kez...@comcast.com:

> A. Sinan Unur wrote:
>
>> Also, I use Cygwin tools as well, and, although I have no proof of
>> this, I am thinking having a C:\usr\bin might cause some confusion in
>> Cygwin Bash.
>
> Bash would not confuse one for the other since the naming conventions
> are different.

Of course. I don't know what I was thinking. Perhaps I took the fact that
I would end up being confused too far. :)

Gunnar Hjalmarsson

unread,
Jul 10, 2005, 10:53:06 PM7/10/05
to
Fabian Pilkowski wrote:
> I don't know about any way to create "symlinks" (or "softlinks") on
> windowish systems (but perhaps it's just me who don't know about).

It seems as if the latter is true. ;-) As I mentioned in another
sub-thread of this thread, I successfully did it following Sinan's tip.

http://groups-beta.google.com/group/comp.lang.perl.misc/msg/46026827a583f19d

0 new messages