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-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=38d91d128accb8367ceb3a84a11eab96dc38dc62;p=scpubgit%2FObject-Remote.git only include mods that match their filename in the fatpack --- 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.';