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