App-SlimPacker
view release on metacpan or search on metacpan
$c = file_content("$td/myapp_bundled");
like $c, qr/^#!\/usr\/bin\/perl\n/, 'shebang first line';
like $c, qr/SlimPacked::/, 'lazy @INC hook emitted';
like $c, qr/"App\/MyMod\.pm" =>/, 'bundled module source held in hook map';
unlike $c, qr/\$INC\{'App\/MyMod\.pm'\}=1;/, 'no eager %INC prefill';
unlike $c, qr/# keep me/, 'module comments minified (default)';
unlike $c, qr/# boot comment/, 'program comments minified (default)';
unlike $c, qr/\$who/, 'short variable renamed (strings with it would block, fixture avoids that)';
unlike $c, qr/use lib/, 'use lib stripped from program';
like $c, qr/BEGIN\{my%sl=\(/, 'compact loader: single BEGIN{my%sl=(...) block';
like $c, qr/bless\\%sl,\$class;/, 'compact loader: bless+unshift {$class} fragment';
unlike $c, qr/__SLPACK_ENTRIES__/, 'loader placeholder spliced away';
like $c, qr/use Compress::Raw::Zlib \(\);/, 'compressed loader: core zlib loaded';
like $c, qr/use MIME::Base64 qw\(decode_base64\);/, 'compressed loader: core base64 loaded';
my ($table) = $c =~ /BEGIN\{my%sl=\((.*?)\);my\$class=/s
or die "cannot locate module table in bundle";
unlike $table, qr/\\\$/, 'module table has no escaped sigils (all single-quoted)';
like $table, qr/"App\/MyMod\.pm" => '[A-Za-z0-9+\/=]+'/, 'module source deflate+base64 in table (default)';
unlike $table, qr/package App::MyMod;/, 'compressed source not embedded verbatim';
like $table, qr/"__MAIN__" => '[A-Za-z0-9+\/=]+'/, 'boot program deflate+base64 in table (default)';
unlike $c, qr/print App::MyMod::greet\('cli'\),/, 'boot program text not embedded verbatim (compressed)';
( run in 0.784 second using v1.01-cache-2.11-cpan-b16cb0d3907 )