develooper Front page | perl.perl5.porters | Postings from July 2005

[perl #36558] Re: [Module::Build] Edge cases in "find_perl" algorithms

Thread Previous
Michael G Schwern
July 14, 2005 14:11
[perl #36558] Re: [Module::Build] Edge cases in "find_perl" algorithms
Message ID:
# New Ticket Created by  Michael G Schwern 
# Please include the string:  [perl #36558]
# in the subject line of all future correspondence about this issue. 
# <URL: >

On Thu, Jul 14, 2005 at 07:47:49AM -0500, Ken Williams wrote:
> If we do allow an uninstalled perl, then what happens when the user 
> does "Build install"?  Unless we add code for adjusting the path, or 
> unless the user provides a suitable --destdir, it'll install to a 
> location that's not ripe yet.

This is the user's problem, and presumably if they're installing modules with
an uninstalled Perl they know something of what they're doing.  They have 
presumably set a prefix or install_base or whatever.  I'll often shove 
stuff into /tmp/lib/ to test out bleadperl.

> The fact that you have to use a relative path rather than an absolute 
> one is a little bit weird, eh?  It means you have to know this weird 
> fact about how perl will be searched for.

I think most folks don't even think about it, it should just work.  Why 
would there be weird searching going on at all?  Normally one wouldn't even 
think a program would have to search for the program which executed it.

> >More common than you think, especially when working on bleadperl.  
> >MakeMaker
> >even has special code to deal with this case:
> >
> >0 ~/devel/ExtUtils-MakeMaker$ ../../../../usr/local/src/bleadperl/perl 
> >-I/usr/local/src/bleadperl/lib -w Makefile.PL
> >... Detected uninstalled Perl.  Trying to continue.
> How do you detect the fact that it's uninstalled?  If this is truly the 
> main use-case for searching in CWD, perhaps we should just add such 
> detection code, and offer to set --destdir appropriately.

Voodoo.  There's a bunch of heuristics in MM_Unix around line 1604
which mostly involves sniffing around for perl.h.  The UNINSTALLED_PERL
flag which gets set is used to make sure that perl can find its libraries 
by setting up the appropriate -Is when its run.

        # Make sure perl can find itself before it's installed.
        $self->{$run} .= q{ "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)"} 
          if $self->{UNINSTALLED_PERL} || $self->{PERL_CORE};

So that might be useful to put into MB.

I think the Perl build process takes advantage of all this when it asks
if you want to install any extra modules from CPAN.  It would be interesting
to see what happened when you ask it for Module::Build.  I think it will
still work as the perl Makefile is smart enough to set PERL5LIB appropriately
rather than rely on the build system to do it.

Michael G Schwern
Just call me 'Moron Sugar'.

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