Re: Problem with LWP when using : to start scripts

Nathan Neulinger (nneul@umr.edu)
Thu, 22 Jan 1998 08:37:29 -0600


That's interesting... I wonder why it worked with the scripts that come 
with perl.

All I am doing is answering 'none' to the config question about how to 
execute perl, and then giving a full path.

Here is what it puts in for the h2ph script:

: # use perl
    eval 'exec /afs/umr.edu/software/perl54/hpux10/bin/perl5 -S $0 ${1+"$@"}'
        if $running_under_some_shell;

In h2ph.PL:


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

This looks like the application has to do it explicitly.

-- Nathan

On Thu, Jan 22, 1998 at 11:02:40AM +0100, Gisle Aas wrote:
> Nathan Neulinger <nneul@umr.edu> writes:
> 
> > On my site, I have several different perl versions installed. I usually 
> > like to have the modules fire off the correct perl depending on which one 
> > they were built with - i.e. h2xs and such.
> > 
> > Second, I have perl stored in a directory that has a LONG path. Normally 
> > people access perl through a symlink, but when installing, the path has 
> > to be specified directly. This doesn't work with #! since it is too long. 
> > However, it works just fine with the : eval exec model.
> > 
> > So, when I build perl, I tell it to exec scripts with the : method.
> > 
> > With the extra scripts in the perl source, this is handled properly, 
> > however with the scripts that LWP installs, this is not handled 
> > correctly, and generates a script that looks like:
> > 
> > -----
> > : # use perl -w
> > 
> > # $Id: lwp-download.PL,v 1.5 1997/12/03 21:21:00 aas Exp $
> > 
> > =head1 NAME
> > -----
> > 
> > This won't run at all.
> > 
> > It would be good to add in the eval exec line to handle this case.
> 
> We used to have an:
> 
>   eval 'exec perl -w -S $0 ${1+"$@"}'
>     if 0;
> 
> line at the beginning of the scripts.  Then at some Perl version
> MakeMaker started adding these lines automatically using MY->fixin().
> This made the installed scripts have two exec lines like the one
> above.
> 
> I think the solution is to fix the MakeMaker fixin() method so that it
> also recoginze start lines like yours.
> 
> Regards,
> Gisle


------------------------------------------------------------
Nathan Neulinger                       EMail:  nneul@umr.edu
University of Missouri - Rolla         Phone: (573) 341-4841
Computing Services                       Fax: (573) 341-4216