App-PerlGzipScript
view release on metacpan or search on metacpan
script/perl-gzip-script view on Meta::CPAN
$parser->getoptionsfromarray(\@ARGV,
"i|in-place" => \my $in_place,
"s|shebang=s" => \(my $shebang = '#!/usr/bin/env perl'),
"h|help" => sub { die $HELP },
"v|version" => sub { printf "v%vd\n", $VERSION; exit },
) or exit 1;
my $script = shift or die "Need SCRIPT argument.\n";
my $out = $in_place ? File::Temp->new(DIR => File::Basename::dirname($script)) : \*STDOUT;
$out->say($shebang);
$out->print(<<'EOF');
use IO::Uncompress::Gunzip ();
IO::Uncompress::Gunzip::gunzip(\*DATA, \my $script, AutoClose => 1, BinModeOut => 1) or die $IO::Uncompress::Gunzip::GunzipError;
eval '#line 1 "' . __FILE__ . "\"\n" . $script;
die $@ if $@;
__DATA__
EOF
my $content = File::Slurper::read_binary($script);
my $content_gzip = Gzip::Libdeflate->new(level => 12)->compress($content) or die;
( run in 2.143 seconds using v1.01-cache-2.11-cpan-9169edd2b0e )