App-plx
view release on metacpan or search on metacpan
maint/buildpack view on Meta::CPAN
mkdir -p "${build_dir}/fatlib/local"
cp "${toolchain_lib}/local/lib.pm" "${build_dir}/fatlib/local/"
mkdir -p "${build_dir}/fatlib/File"
cp "${toolchain_lib}/File/Which.pm" "${build_dir}/fatlib/File/"
fragment () {
PATH="${toolchain_dir}/bin:${PATH}" PERL5LIB="$toolchain_lib" perl -e '
use File::Which;
my $cpanm = do { local (@ARGV, $/) = which("cpanm"); <> };
$cpanm =~ s/^/ /mg;
$cpanm =~ s/"--> Working on/"--"."> Working on/;
(my $out = $ARGV[0]) =~ s/__CPANM__/$cpanm/;
print $out
' '
BEGIN {
our $INLINE_CPANM = <<'"'"'CPANM'"'"';
__CPANM__
CPANM
if (@ARGV and $ARGV[0] eq "--spiner") {
shift @ARGV;
my $cpanm = $INLINE_CPANM;
$cpanm =~ s/^ //mg;
$cpanm =~ s/\Qunless (caller)/if (1)/;
warn "Running packed cpanm\n";
eval $cpanm;
die $@ if $@;
exit 0;
}
}
local *App::plx::find_cpanm = sub {
return ($0, "--spiner") unless $0 eq "-";
require File::Temp;
# the tempfile will get unlinked when the 'local' of this sub vanishes
use feature 'state';
state $tempfile = do {
my $fh = File::Temp->new;
my $cpanm = $INLINE_CPANM;
$cpanm =~ s/^ //mg;
print $fh $cpanm;
close $fh;
$fh;
};
return ($tempfile->filename);
};
'
}
(
echo '#!/usr/bin/env perl';
cd "$project_dir";
PERL5LIB="$toolchain_lib" perl -E \
'require "./bin/plx"; say q{$App::plx::VERSION = }.$App::plx::VERSION.";";'
(cd "$build_dir"; PATH="${toolchain_dir}/bin:${PATH}" \
PERL5LIB="$toolchain_lib" fatpack file);
fragment;
cat "${project_dir}/bin/plx";
) >"$packed_temp"
chmod --reference="$packed_file" "$packed_temp" 2>/dev/null || chmod 0644 "$packed_temp"
mv "$packed_temp" "$packed_file"
( run in 1.386 second using v1.01-cache-2.11-cpan-302cb4679cc )