Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Perl interpretation of weird #! line

by rinceWind (Monsignor)
on Jan 09, 2006 at 11:48 UTC ( #521898=note: print w/replies, xml ) Need Help??

in reply to Perl interpretation of weird #! line

As others have said, what you have is a shebang line for a script that has not yet been deployed.

What is to the right of the #! has no effect on Windows systems, as these find perl using a file type association, or the script gets turned into a .bat file with a different preamble. If the line could be parsed into a perl command and options, e.g. -w these options would be applied.

Unix systems expect to see the full path to perl. Sometimes #!perl will work via $ENV{PATH}, but this is considered unreliable and insecure.

The standard script installing mechanism used by ExtUtils::MakeMaker invokes MY->fixin over each script. This will cause your placeholder shebang line to be replaced with a real one that has a path to perl. The fixin method does different things depending on your platform, for example it runs pl2bat on Windows.

On Unix, fixin does the following:

  • Extract the command and any arguments

  • If the command is the string 'perl' get the interpreter path from $Config{startperl}.

  • Else if there was a different command parsed out, use $Config{perlpath}

  • Otherwise, try and find the perl executable by looking in the path.


Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ?
(Missquoting Janis Joplin)

  • Comment on Re: Perl interpretation of weird #! line

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2022-05-18 09:17 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (70 votes). Check out past polls.