develooper Front page | perl.perl5.porters | Postings from June 2015

Re: [perl #124346] Respect perl6 in hashbang

Thread Previous | Thread Next
Ævar Arnfjörð Bjarmason
June 22, 2015 12:37
Re: [perl #124346] Respect perl6 in hashbang
Message ID:
On Sun, Apr 19, 2015 at 3:53 PM, Leon Timmermans
<> wrote:
> # New Ticket Created by  Leon Timmermans
> # Please include the string:  [perl #124346]
> # in the subject line of all future correspondence about this issue.
> # <URL: >
> This is a bug report for perl from,
> generated with the help of perlbug 1.40 running under perl 5.20.1.
> -----------------------------------------------------------------
> Currently, when perl tries to run a script and it encounters a hashbang
> line not containing the string "perl" (e.g. /usr/bin/python), it will
> instead run that executable. This works for most other languages, but for
> perl6 this doesn't switch gracefully for obvious reasons.
> The attached patch tries to fix that, so that #!perl6 files will DWIM.

I think this patch makes sense, but I wonder if other cases could also
DWYM. Currently these shebangs trigger these behaviors, where "exec"
is "execute other interpreter" and "ignore" is "treat it as a

#!/bin/sh => exec
#!sh => exec
#!rakudo => exec
#!perl => exec
#!/bin/perl => ignore
#!thewordperlinthemiddleofastring => ignore
#!perl5.18.2 => ignore
#!perl6 => ignore
#!/bin/perl6 => ignore
#!rakudoperl6 =>  ignore
#!rakudoperlsix => ignore
#!company-perl => ignore
#!company-perl5.18.2 => ignore

You patch would alter the behavior of these:

#!perl6 => exec
#!/bin/perl6 => exec
#!rakudoperl6 =>  exec

I think that makes sense, but I wonder if we're being overly eager
currently about recognizing the "perl" substring anywhere in the
shebang. But on the other hand we have things like
"#!/usr/local/bin/company-perl5.18.2" which relies on this behavior.
So I don't know.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About