develooper Front page | perl.ponie.dev | Postings from August 2005

Re: startperl insanity

Thread Previous | Thread Next
From:
Graham Barr
Date:
August 11, 2005 03:03
Subject:
Re: startperl insanity
Message ID:
95505D66-4BAA-45EB-BB38-674E168A6FC0@pobox.com

On Aug 10, 2005, at 4:43 PM, Nicholas Clark wrote:

> This I do not understand. If I change config.sh so that 'startperl' is
> something odd that does not m!/perl$! *then*
>
> ext/Devel/DProf/t/DProf.t
> lib/h2ph.t
> lib/h2xs.t
>
> fail, because they report errors such as:
>
> not ok 3 - running ./perl "-I../lib" "-I../../lib" ../utils/h2xs -f  
> -n h2xst 2>&1
> #     Failed test (lib/h2xs.t at line 168)
> #          got: 512
> #     expected: 0
> not ok 4 - running ./perl "-I../lib" "-I../../lib" ../utils/h2xs -f  
> -n h2xst 2>&1
> #     Failed test (lib/h2xs.t at line 179)
> #          got: 'Can't exec /Users/nick/Sandpit/frob/spong at ../ 
> utils/h2xs line 1.
> # '
> #     expected: 'Defaulting to backwards compatibility with perl 5.9.3
>
>
> which somewhat makes sense, as the #! for dprofpp, h2ph and h2xs is
>
> #!/Users/nick/Sandpit/frob/spong
>     eval 'exec /Users/nick/Sandpit/blead25277/bin/perl5.9.3 -S $0  
> ${1+"$@"}'
>         if $running_under_some_shell;

Thats a bug in the .PL script that generates them. perlrun describes  
this

     #!/bin/sh -- # -*- perl -*- -p
     eval 'exec /usr/bin/perl $0 -S ${1+"$@"}'
         if $running_under_some_shell;

So those .PL scripts should probably have

print OUT <<"!GROK!THIS!";
$Config{startperl} -- # -*- perl -*-
     eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
         if \$running_under_some_shell;
!GROK!THIS!

Or the exec should have -x and the line #!perl added after the if

Graham.

> If I install "/Users/nick/Sandpit/frob/spong" then all is happy.
> If I change the #! line to a /Users/nick/Sandpit/frob/perl then all  
> is happy.
>
> Is this something to do with:
>
>     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 F</usr/bin/perl>, and  
> Perl will then
>     dispatch the program to the correct interpreter for them.
>
>
> Is it possible to disable it with a flag?
> Or should I just try cutting the code out of ponie.
>
>
> Nicholas Clark
>
>


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