Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Perl thinks it's the shell!

by ikegami (Patriarch)
on Jun 02, 2005 at 04:27 UTC ( [id://462746]=note: print w/replies, xml ) Need Help??


in reply to Perl thinks it's the shell!

From perlrun,

If the #! line does not contain the word ``perl'', the program named after the #! is executed instead of the Perl interpreter. This is slightly bizarre, but it helps people on machines that don't do #!, because they can tell a program that their SHELL is /usr/bin/perl, and Perl will then dispatch the program to the correct interpreter for them.

Also, I believe Apache uses the #! line rather the file association.

On a related note, (again from perlrun)

The #! line is always examined for switches as the line is being parsed. Thus, if you're on a machine that allows only one argument with the #! line, or worse, doesn't even recognize the #! line, you still can get consistent switch behavior regardless of how Perl was invoked, even if -x was used to find the beginning of the program.

so -w and other switches on the #! line will work in Windows, even though Windows doesn't know about the #! line.

Replies are listed 'Best First'.
Re^2: Perl thinks it's the shell!
by misterw (Acolyte) on Jun 02, 2005 at 05:23 UTC
    Thanks so much. I thought I was going NUTS!

    In correction to my original post (since updated) it does work with callperl.exe but originally it was

    !#/c/apps/pp3.exe
    and that didn't work , which added to my confusion(I should have noticed this when posting). Seeing this, I then actually started adding and deleting letters from the shebang line and got what seemed to be random results.
    !#/c/apps/callperl.exe and !#/c/apps/callperllllll.exe
    worked but
    !#/c/apps/callpe.exe
    failed

    I didn't happen to think that it might be to do with the word perl

    Thanks again for the quick response, You get good service here!!!

    This is the second time I have come across mysterious (yes, should have read the docs) perl (related - though not perls fault) problems on windows. At first callperl.exe kept stealing spaces from my command line arguments until I realised that you need to double quote all command line parameters containing spaces. This is important for system and exec in c which call CreateProcess on windows platforms.

    Matt

      Fellow misterw
      This is a classical. :-) Just do like the emacs users do:

      #!/c/apps/pp3.exe # -*- perl -*-

      This solves your problem, I guess. This solved my problems, when I was dealing with this kind'o'stuff.

      May the gods bless your work.

        Yes, a typo in my post, nothing to do with the problem at hand

Re^2: Perl thinks it's the shell!
by Stoffe (Sexton) on Jun 02, 2005 at 19:01 UTC

    Verging on OT, but:

    Also, I believe Apache uses the #! line rather the file association.
    Correct. When I used Windows, I always installed ActivePerl to c:/usr/ instead of the standard c:/Perl/, this way the standard shebang (#!/usr/bin/perl) worked without any conversions, assuming of course that Apache also was on C:

      What I do is install Activestate Perl in the default spot then create the directory path C:\usr\bin\ into which I drag-drop a copy of perl.exe. Apache uses this executable as detailed in the shebang #!/usr/bin/perl . Since the executable knows where its libs are, everything works like a charm. You can then take your locally-developed scripts and port them to *nix platforms if you want with nary an edit!

      (Ph) Phaysis (Shawn)
      If idle hands are the tools of the devil, are idol tools the hands of god?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://462746]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-26 01:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found