App-BCSSH

 view release on metacpan or  search on metacpan

maint/pack  view on Meta::CPAN

warn $perl_version;
my @trace_extras;
my @trace;
for my $file (@trace_in) {
    my $mod = $file;
    $mod =~ s/\.pm$//;
    $mod =~ s{/}{::}g;

    next
        if $mod =~ $exclude;
    next
        if grep { $mod eq $_ } @modules;

    if (my $first_release = Module::CoreList->first_release($mod)) {
        if ($first_release <= $perl_version && !Module::CoreList->removed_from($mod)) {
            my $version = eval($Module::CoreList::version{$perl_version}{$mod} || 0);
            my $required = eval($prereqs->{$mod} || 0);
            if ($required <= $version) {
                next;
            }
        }
    }

    if (grep { $mod =~ /^$_(::|$)/ } @traceonly) {
        push @trace_extras, $file;
    }
    else {
        push @trace, $file;
    }
}

my @packlists = `fatpack packlists-for @trace`;
chomp @packlists;

rmtree('fatlib');
system 'fatpack', 'tree', @packlists;
for my $mod (@dual) {
    (my $path = $mod) =~ s{::}{/}g;
    rmtree("fatlib/$Config{archname}/auto/$path");
}
find({no_chdir => 1, wanted => sub {
    -f or return;
    unlink $_ if /\.pod$/;
}}, 'fatlib');
for my $file (@trace_extras) {
    my ($full_file) = grep { -f } map { "$_/$file" } @INC;
    my $dest = "fatlib/$file";
    mkpath(dirname($dest));
    copy $full_file, $dest;
}

find({no_chdir => 1, wanted => sub {
    -f or return;
    /\.pm$/ or return;
    my $file = $_;
    open my $fh, '>', "$file.strip";
    my $strip = Pod::Strip->new;
    $strip->output_fh($fh);
    $strip->parse_file($file);
    close $fh;
    rename "$file.strip", $file;
}}, 'fatlib');

my $content = "#!/usr/bin/env perl\n";
$content .= `fatpack file`;
my $pack_hack = <<'END_HACK';
sub _fatpacker::modules {
    my @mods = sort keys %fatpacked;
    for (@mods) {
        s/\.pm$//;
        s{/}{::}g;
    }
    return @mods;
}
END_HACK
$content =~ s{(my \%fatpacked;)}{$1\n$pack_hack};
my $script = do {
    open my $fh, '<', $in_file;
    local $/;
    <$fh>
};
$script =~ s/^#!.*\n//;
$content .= $script;

unless ($ENV{FATPACK_NO_CLEANUP}) {
    rmtree('fatlib');
    unlink 'fatpacker.trace';
}

print $content;



( run in 0.516 second using v1.01-cache-2.11-cpan-6aa56a78535 )