use File::Path qw(make_path remove_tree);
use B qw(perlstring);
-our $VERSION = '0.009001'; # 0.9.1
+our $VERSION = '0.009003'; # 0.9.3
$VERSION = eval $VERSION;
sub run_script {
my ($self, $args) = @_;
my @args = $args ? @$args : @ARGV;
- (my $cmd = shift @args) =~ s/-/_/g;
+ (my $cmd = shift @args || 'help') =~ s/-/_/g;
if (my $meth = $self->can("script_command_${cmd}")) {
$self->$meth(\@args);
} else {
}
}
+sub script_command_help {
+ print "Try `perldoc fatpack` for how to use me\n";
+}
+
sub script_command_trace {
my ($self, $args) = @_;
unshift @INC, sub {
if (my $fat = $fatpacked{$_[1]}) {
- open my $fh, '<', \$fat;
+ open my $fh, '<', \$fat
+ or die "FatPacker error loading $_[1] (could be a perl installation issue?)";
return $fh;
}
return
my @segments = map {
(my $stub = $_) =~ s/\.pm$//;
my $name = uc join '_', split '/', $stub;
- my $data = $files{$_}; $data =~ s/^/ /mg;
+ my $data = $files{$_}; $data =~ s/^/ /mg; $data =~ s/(?<!\n)\z/\n/;
'$fatpacked{'.perlstring($_).qq!} = <<'${name}';\n!
.qq!${data}${name}\n!;
} sort keys %files;
=head1 SYNOPSIS
$ fatpack trace myscript.pl
- $ fatpack packlists-for `cat factpacker.trace` >packlists
- $ fatpack tree fatlib `cat packlists`
+ $ fatpack packlists-for `cat fatpacker.trace` >packlists
+ $ fatpack tree `cat packlists`
$ (fatpack file; cat myscript.pl) >myscript.packed.pl
See the documentation for the L<fatpack> script itself for more information.