1 package Object::Remote::ModuleSender;
5 use List::Util qw(first);
8 has dir_list => (is => 'lazy');
11 my %core = map +($_ => 1), grep $_, @Config{
12 qw(privlibexp archlibexp vendorarchexp sitearchexp)
14 [ grep !$core{$_}, @INC ];
18 my ($self, $module) = @_;
19 if (my $find = Object::Remote::FromData->can('find_module')) {
20 if (my $source = $find->($module)) {
24 my ($found) = first { -f $_ }
25 map File::Spec->catfile($_, $module),
27 die "Couldn't find ${module} in remote \@INC. dir_list contains:\n"
28 .join("\n", @{$self->dir_list})
30 open my $fh, '<', $found or die "Couldn't open ${found} for ${module}: $!";
31 return do { local $/; <$fh> };