sub script_command_pack {
my ($self, $args) = @_;
+ $args = $self->call_parser($args => [
+ 'core-only' => \my $core_only,
+ ]);
+
my @modules = split /\r?\n/, $self->trace(args => $args);
my @packlists = $self->packlists_containing(\@modules);
$self->packlists_to_tree($base, \@packlists);
my $file = shift @$args;
- print $self->fatpack_file($file);
+ print $self->fatpack_file($file, $core_only);
}
sub script_command_trace {
sub script_command_file {
my ($self, $args) = @_;
+
+ $args = $self->call_parser($args => [
+ 'core-only' => \my $core_only,
+ ]);
+
my $file = shift @$args;
- print $self->fatpack_file($file);
+ print $self->fatpack_file($file, $core_only);
}
sub fatpack_file {
- my ($self, $file) = @_;
+ my ($self, $file, $core_only) = @_;
my $shebang = "";
my $script = "";
my %files;
$self->collect_files($_, \%files) for @dirs;
- return join "\n", $shebang, $self->fatpack_code(\%files), $script;
+ my $lib_reset =
+ "BEGIN { use Config; \@INC = \@Config{qw(privlibexp archlibexp sitelibexp sitearchexp)} }\n";
+
+ return join "\n", $shebang, ($core_only ? $lib_reset : ()), $self->fatpack_code(\%files), $script;
}
# This method can be overload in sub classes