Skip to content

Commit

Permalink
Do not modify @inc. Because LWP uses lazy loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
tokuhirom committed Nov 24, 2010
1 parent 66e7173 commit d873f36
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile.PL
Expand Up @@ -6,7 +6,7 @@ WriteMakefile(
'LWP' => 0,
'IO::Zlib' => 0,
'version' => 0,
'local::lib' => 0,
'local::lib' => 1.006008,
'ExtUtils::MakeMaker' => 6.56,
'CPAN::DistnameInfo' => 0.10,
},
Expand Down
28 changes: 15 additions & 13 deletions bin/cpan-outdated
Expand Up @@ -43,9 +43,8 @@ unless ($ENV{HARNESS_ACTIVE}) {
sub main {
init_tools();

if ($local_lib) {
setup_local_lib($local_lib, $self_contained);
}
my @libpath = make_inc($local_lib, $self_contained);
# warn join("\n", @libpath);

my $tmpfile = File::Temp->new(UNLINK => 1, SUFFIX => '.gz');
getstore($index_url, $tmpfile->filename) or die "Cannot getstore file";
Expand All @@ -64,7 +63,7 @@ sub main {
next if $dist =~ m{/perl-[0-9._]+\.tar\.gz$};
(my $file = $pkg) =~ s!::!/!g;
$file = "${file}.pm";
SCAN_INC: for my $dir (@INC) {
SCAN_INC: for my $dir (@libpath) {
my $path = "$dir/$file";
next SCAN_INC unless -f $path;

Expand Down Expand Up @@ -238,21 +237,24 @@ sub init_tools {
}
}

sub setup_local_lib {
sub make_inc {
my ($base, $self_contained) = @_;
$base ||= '~/perl5/';

require local::lib;
if ($self_contained) {
@INC = (
if ($base) {
require local::lib;
my @modified_inc = (
local::lib->install_base_perl_path($base),
local::lib->install_base_arch_path($base),
@Config{qw(privlibexp archlibexp)},
);
if ($self_contained) {
push @modified_inc, @Config{qw(privlibexp archlibexp)};
} else {
push @modified_inc, @INC;
}
return @modified_inc;
} else {
return @INC;
}

local $SIG{__WARN__} = sub { }; # catch 'Attempting to write ...'
local::lib->import($base);
}

__END__
Expand Down

0 comments on commit d873f36

Please sign in to comment.