X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FApp%2FFatPacker.pm;h=1aaba1c53019ed1d00b3afe0dc3f78872879b06a;hb=ef3dc7725bcd41282269b299fda0c65c2ad034c3;hp=16b8cddff685941f9ef91f3308395caffb06b1fc;hpb=56a51caacfbeef8aaa808be284f4bd0ef4095993;p=p5sagit%2FApp-FatPacker.git diff --git a/lib/App/FatPacker.pm b/lib/App/FatPacker.pm index 16b8cdd..1aaba1c 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.009018'; # 0.009.017 +our $VERSION = '0.010000'; # 0.10.0 $VERSION = eval $VERSION; @@ -268,24 +268,37 @@ sub fatpack_end { return stripspace <<' END_END'; s/^ //mg for values %fatpacked; - unshift @INC, sub { - if (my $fat = $fatpacked{$_[1]}) { - if ($] < 5.008) { - return sub { - return 0 unless length $fat; - $fat =~ s/^([^\n]*\n?)//; - $_ = $1; - return 1; - }; + my $class = 'FatPacked::'.(0+\%fatpacked); + no strict 'refs'; + *{"${class}::files"} = sub { keys %{$_[0]} }; + + 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; + }; + } + + else { + *{"${class}::INC"} = sub { + if (my $fat = $_[0]{$_[1]}) { + open my $fh, '<', \$fat + or die "FatPacker error loading $_[1] (could be a perl installation issue?)"; + return $fh; } - open my $fh, '<', \$fat - or die "FatPacker error loading $_[1] (could be a perl installation issue?)"; - return $fh; - } - return - }; + return; + }; + } - } # END OF FATPACK CODE + unshift @INC, bless \%fatpacked, $class; + } # END OF FATPACK CODE END_END } @@ -321,7 +334,7 @@ Or, with more step-by-step control: See the documentation for the L script itself for more information. -The programmatic API for this code is not yet fully decided, hence the 0.9 +The programmatic API for this code is not yet fully decided, hence the 0.x release version. Expect that to be cleaned up for 1.0. =head1 SEE ALSO @@ -330,7 +343,7 @@ L
=head1 SUPPORT -Your current best avenue is to come annoy annoy mst on #toolchain on +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. =head1 AUTHOR @@ -357,6 +370,10 @@ Mithaldu - Christian Walde (cpan:MITHALDU) dolmen - Olivier Mengué (cpan:DOLMEN) +djerius - Diab Jerius (cpan:DJERIUS) + +haarg - Graham Knop (cpan:HAARG> + Many more people are probably owed thanks for ideas. Yet another doc nit to fix.