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

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

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

On Wed, Jul 13, 2005 at 10:15:50PM -0500, Ken Williams wrote:
> That's good analysis, but I don't actually think anything should be 
> changed in Module::Build's method until we can demonstrate a case in 
> which it fails, and right now I know of none.  Since it checks 
> Config::myconfig(), it ensures that the version and any compilation 
> options are correct.

Installing Module::Build with an uninstalled Perl (ie. you build Perl and
run it from the source directory) will fail to find perl.

0 ~/devel/Module-Build$ ../../../../usr/local/src/bleadperl/perl -I/usr/local/src/bleadperl/lib -w Build.PL
Warning: Can't locate your perl binary at lib/Module/Build/ line 139.

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.
Have /usr/local/src/bleadperl/lib/ expected /usr/local/perl/bleadperl/lib/5.9.3/darwin-thread-multi-2level/
Writing Makefile for ExtUtils::MakeMaker

The simple fix is to do the $cwd/$^X check if $^X is ./foo or ../foo.

Why wait until someone gets bit in the ass?

> Perhaps it could also check a variable like $Config{installarchlib} or 
> something, to make sure we've got the right library path, in case the 
> crazy user has two exactly identically-configured perls installed in 
> two different places we happen to find with the search algorithm.

Or you could just compare the values of $INC{""}.

Michael G Schwern
Ahh email, my old friend.  Do you know that revenge is a dish that is best 
served cold?  And it is very cold on the Internet! Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About