X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=script%2Fenv;h=82565417fb1aa4f390d0d3ab5214a7376bc3621f;hb=1ff94f744944764df3f541f7caf739180e90e17b;hp=d7c7686bce1f3750e79839c50d98a62d9a209770;hpb=42b626cdae7cb7a3d8a911bdb0c0b23f073763af;p=catagits%2FGitalist.git diff --git a/script/env b/script/env index d7c7686..8256541 100755 --- a/script/env +++ b/script/env @@ -30,14 +30,21 @@ use warnings; use Carp; use lib; use FindBin; +use File::Spec (); +use Cwd (); -my $basedir; -if (-r "$FindBin::Bin/Makefile.PL") { - $basedir = $FindBin::Bin; -} -elsif (-r "$FindBin::Bin/../Makefile.PL") { - $basedir = "$FindBin::Bin/.."; -} +# Look up to see find Makefile.PL aka the base of the local::lib install. +my $lookup; $lookup = sub { + my $dir = $_[0] || $FindBin::Bin; + + return '' if Cwd::abs_path($dir) eq File::Spec->rootdir; + + my $tryfile = File::Spec->catfile($dir, "Makefile.PL"); + + return -r $tryfile ? $dir : $lookup->( File::Spec->catdir($dir, File::Spec->updir) ); +}; + +my $basedir = $lookup->(); $basedir ||= ''; my $target = "$basedir/local-lib5"; @@ -63,8 +70,10 @@ if ( $on ) { $ENV{PERL_MM_OPT} .= " INSTALLMAN1DIR=none INSTALLMAN3DIR=none"; + require lib::core::only; require local::lib; - local::lib->import( '--self-contained', $target ); + lib::core::only->import(); + local::lib->import( $target ); } unless ( caller ) {