From: skaufman Date: Fri, 17 Jul 2015 21:03:28 +0000 (+0000) Subject: only include mods that match their filename in the fatpack X-Git-Tag: v0.003005~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=commitdiff_plain;h=e454581efc719427e401b14e94d520288bcabdcc only include mods that match their filename in the fatpack --- diff --git a/Changes b/Changes index 094194d..2597522 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ + - Skip non-primary modules in a file to ensure we generate a sane fatpack + 0.003004 - 2014-10-04 - Explicitly load Moo::HandleMoose::_TypeMap since it isn't loaded sans ithreads but we don't know if the foreign perl requires it diff --git a/lib/Object/Remote/FatNode.pm b/lib/Object/Remote/FatNode.pm index fe07f29..8b143b8 100644 --- a/lib/Object/Remote/FatNode.pm +++ b/lib/Object/Remote/FatNode.pm @@ -47,9 +47,16 @@ $command =~ s/\n/ /g; chomp(my @inc = qx($command)); my %exclude = map { $_ => 1 } @exclude_mods; -my %mods = reverse @inc; + my %file_names = @inc; +# only include mods that match the filename, +# ie ones that will succeed with a require $module +# https://rt.cpan.org/Ticket/Display.html?id=100478 +my %mods = + map { $file_names{$_} => $_ } + grep { $file_names{$_} =~ /\Q$_\E$/ } keys %file_names; + foreach(keys(%mods)) { if ($exclude{ $mods{$_} }) { delete($mods{$_}); diff --git a/t/fatnode.t b/t/fatnode.t new file mode 100644 index 0000000..26878f8 --- /dev/null +++ b/t/fatnode.t @@ -0,0 +1,15 @@ +use strict; +use warnings; + +use strictures 1; +use Test::More; + +plan tests => 1; + +require Object::Remote::FatNode; +my $data = do { + no warnings 'once'; + $Object::Remote::FatNode::DATA; +}; + +ok $data !~ m|MODULELOADER_HOOK|mx,'MODULELOADER_HOOK should not be in the fatpack.';