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

Re: [perl #124346] Respect perl6 in hashbang

Thread Previous | Thread Next
From:
Ævar Arnfjörð Bjarmason
Date:
June 22, 2015 12:37
Subject:
Re: [perl #124346] Respect perl6 in hashbang
Message ID:
CACBZZX73s05HeWD0=HEuuXHviw_W7KxNv6Rw3cOpVSLZda8V+A@mail.gmail.com
On Sun, Apr 19, 2015 at 3:53 PM, Leon Timmermans
<perlbug-followup@perl.org> 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: https://rt.perl.org/Ticket/Display.html?id=124346 >
>
>
> This is a bug report for perl from fawaka@gmail.com,
> 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
comment":

#!/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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About