use strict;
use warnings FATAL => 'all';
+use 5.008001;
use Getopt::Long;
use Cwd qw(cwd);
use File::Find qw(find);
use File::Path qw(mkpath rmtree);
use B qw(perlstring);
-our $VERSION = '0.009012'; # 0.9.012
+our $VERSION = '0.009013'; # 0.9.013
$VERSION = eval $VERSION;
if ($] < 5.008) {
return sub {
return 0 unless length $fat;
- $text =~ s/^([^\n]*\n?)//;
+ $fat =~ s/^([^\n]*\n?)//;
$_ = $1;
return 1;
};
'$fatpacked{'.perlstring($_).qq!} = <<'${name}';\n!
.qq!${data}${name}\n!;
} sort keys %files;
- print join "\n", $start, @segments, $end;
+ my $shebang = "";
+ my $script = "";
+ if ( defined $file and -r $file ) {
+ open my $fh, "<", $file or die("Can't read $file: $!");
+ $shebang = <$fh>;
+ $script = join "", <$fh>;
+ close $fh;
+ unless ( index($shebang, '#!') == 0 ) {
+ $script = $shebang . $script;
+ $shebang = "";
+ }
+ }
+ print join "\n", $shebang, $start, @segments, $end, $script;
}
=encoding UTF-8
$ fatpack trace myscript.pl
$ fatpack packlists-for `cat fatpacker.trace` >packlists
$ fatpack tree `cat packlists`
- $ (fatpack file; cat myscript.pl) >myscript.packed.pl
+ $ fatpack file myscript.pl >myscript.packed.pl
See the documentation for the L<fatpack> script itself for more information.