use File::Spec::Functions qw(
catdir splitpath splitdir catpath rel2abs abs2rel
);
+use File::Spec::Unix;
use File::Copy qw(copy);
use File::Path qw(mkpath rmtree);
use B qw(perlstring);
-our $VERSION = '0.009009'; # 0.9.9
+our $VERSION = '0.009013'; # 0.9.013
$VERSION = eval $VERSION;
my ($self, $args) = @_;
my $file = shift @$args;
my $cwd = cwd;
- my @dirs = map rel2abs($_, $cwd), ('lib','fatlib');
+ my @dirs = grep -d, map rel2abs($_, $cwd), ('lib','fatlib');
my %files;
foreach my $dir (@dirs) {
find(sub {
return unless -f $_;
!/\.pm$/ and warn "File ${File::Find::name} isn't a .pm file - can't pack this and if you hoped we were going to things may not be what you expected later\n" and return;
- $files{abs2rel($File::Find::name,$dir)} = do {
+ $files{File::Spec::Unix->abs2rel($File::Find::name,$dir)} = do {
local (@ARGV, $/) = ($File::Find::name); <>
};
+ close ARGV;
}, $dir);
}
my $start = stripspace <<' END_START';
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;
+ };
+ }
open my $fh, '<', \$fat
or die "FatPacker error loading $_[1] (could be a perl installation issue?)";
return $fh;
print join "\n", $start, @segments, $end;
}
+=encoding UTF-8
+
=head1 NAME
App::FatPacker - pack your dependencies onto your script file
$ fatpack trace myscript.pl
$ fatpack packlists-for `cat fatpacker.trace` >packlists
$ fatpack tree `cat packlists`
- $ (fatpack file; cat myscript.pl) >myscript.packed.pl
+ $ (head -n1 myscript.pl |grep '^#!'; fatpack file; cat myscript.pl) >myscript.packed.pl
+
+The C<head -n1 myscript.pl |grep '^#!'> code pulls out the Unix shebang
+line, if there is one, and injects it at the start of the packed script.
See the documentation for the L<fatpack> script itself for more information.
ether - Karen Etheridge (cpan:ETHER) <ether@cpan.org>
+Mithaldu - Christian Walde (cpan:MITHALDU) <walde.christian@googlemail.com>
+
Many more people are probably owed thanks for ideas. Yet
another doc nit to fix.