=head2 trace
- $ fatpack trace [--to=trace-file|--to-stderr] myscript.pl
+ $ fatpack trace [--to=trace-file|--to-stderr] [--use=MODULE]
+ myscript.pl
Compiles myscript.pl (as in "perl -c") and writes out a trace file containing
every module require()d during the compilation.
You cannot pass both --to and --to-stderr.
+If the --use option specifies a module (or modules, if used multiple
+times) those modules will be additionally included in the trace output.
+
=head2 packlists-for
$ fatpack packlists-for Module1 Module2 Module3
$args = call_parser $args => [
'to=s' => \my $file,
'to-stderr' => \my $to_stderr,
+ 'use=s' => \my @additional_use
];
die "Can't use to and to-stderr on same call" if $file && $to_stderr;
- (my $use_file = $file) ||= 'fatpacker.trace';
- if (!$to_stderr and -e $use_file) {
- unlink $use_file or die "Couldn't remove old trace file: $!";
+ $file ||= 'fatpacker.trace';
+ if (!$to_stderr and -e $file) {
+ unlink $file or die "Couldn't remove old trace file: $!";
}
my $arg = do {
- if ($file) {
- "=>>${file}"
- } elsif ($to_stderr) {
+ if ($to_stderr) {
"=>&STDERR"
- } else {
- ""
+ } elsif ($file) {
+ "=>>${file}"
}
};
+
+ if(@additional_use) {
+ $arg .= "," . join ",", @additional_use;
+ }
+
{
local $ENV{PERL5OPT} = '-MApp::FatPacker::Trace'.$arg;
system $^X, @$args;
See the documentation for the L<fatpack> script itself for more information.
-The programmatic API for this code is not yet fully decided, hence the 0.9.1
+The programmatic API for this code is not yet fully decided, hence the 0.9
release version. Expect that to be cleaned up for 1.0.
=head1 SUPPORT
my %initial_inc;
sub import {
- $trace_file = $_[1] || '>>fatpacker.trace';
+ my(undef, $file, @extras) = @_;
+
+ $trace_file = $file || '>>fatpacker.trace';
# For filtering out our own deps later.
# (Not strictly required as these are core only and won't have packlists, but
# looks neater.)
%initial_inc = %INC;
+
+ # Use any extra modules specified
+ eval "use $_" for @extras;
+
B::minus_c;
}