X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FApp%2FFatPacker.pm;h=28e7c075503d80e6b5522fdf4f2dca30e3404a65;hb=6d86a641f475a53f598bbadff9e0a6f39062997a;hp=339cd3646b5a06aaad2e89ad7fb61cacaf69dd7e;hpb=6346585ce18ce7dbb28b4377ecbea7dbc070dc86;p=p5sagit%2FApp-FatPacker.git diff --git a/lib/App/FatPacker.pm b/lib/App/FatPacker.pm index 339cd36..28e7c07 100644 --- a/lib/App/FatPacker.pm +++ b/lib/App/FatPacker.pm @@ -14,7 +14,7 @@ use File::Copy qw(copy); use File::Path qw(mkpath rmtree); use B qw(perlstring); -our $VERSION = '0.010003'; # 0.10.3 +our $VERSION = '0.010007'; # 0.10.7 $VERSION = eval $VERSION; @@ -142,11 +142,16 @@ sub script_command_packlists_for { sub packlists_containing { my ($self, $targets) = @_; - my @targets = @$targets; + my @targets; { local @INC = ('lib', @INC); - foreach my $t (@targets) { - require $t; + foreach my $t (@$targets) { + unless (eval { require $t; 1}) { + warn "Failed to load ${t}: $@\n" + ."Make sure you're not missing a packlist as a result\n"; + next; + } + push @targets, $t; } } my @search = grep -d $_, map catdir($_, 'auto'), @INC; @@ -178,8 +183,11 @@ sub packlists_to_tree { my $pack_base; PART: foreach my $p (0 .. $#dir_parts) { if ($dir_parts[$p] eq 'auto') { - # $p-2 since it's /$Config{archname}/auto - $pack_base = catpath $vol, catdir @dir_parts[0..$p-2]; + # $p-2 normally since it's /$Config{archname}/auto but + # if the last bit is a number it's $Config{archname}/$version/auto + # so use $p-3 in that case + my $version_lib = 0+!!($dir_parts[$p-1] =~ /^[0-9.]+$/); + $pack_base = catpath $vol, catdir @dir_parts[0..$p-(2+$version_lib)]; last PART; } } @@ -278,15 +286,17 @@ sub fatpack_end { if ($] < 5.008) { *{"${class}::INC"} = sub { - if (my $fat = $_[0]{$_[1]}) { - return sub { - return 0 unless length $fat; - $fat =~ s/^([^\n]*\n?)//; - $_ = $1; - return 1; - }; - } - return; + if (my $fat = $_[0]{$_[1]}) { + my $pos = 0; + my $last = length $fat; + return (sub { + return 0 if $pos == $last; + my $next = (1 + index $fat, "\n", $pos) || $last; + $_ .= substr $fat, $pos, $next - $pos; + $pos = $next; + return 1; + }); + } }; } @@ -347,8 +357,10 @@ L
=head1 SUPPORT -Your current best avenue is to come annoy mst on #toolchain on -irc.perl.org. There should be a non-IRC means of support by 1.0. +Bugs may be submitted through L +(or L). + +You can normally also obtain assistance on irc, in #toolchain on irc.perl.org. =head1 AUTHOR