X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=blobdiff_plain;f=lib%2FObject%2FRemote%2FModuleSender.pm;h=6624d6b8fdd21a9abc463bf31cd5da64d5caf38b;hp=f33a1d5fd4c3bcb870591acfb73b59cbe3e2f144;hb=8c3529062a426181861d58ee59fb8f10e0be68e5;hpb=df8e0ca6a336fb37fd14d40fa345e787bc75b8c2 diff --git a/lib/Object/Remote/ModuleSender.pm b/lib/Object/Remote/ModuleSender.pm index f33a1d5..6624d6b 100644 --- a/lib/Object/Remote/ModuleSender.pm +++ b/lib/Object/Remote/ModuleSender.pm @@ -1,5 +1,6 @@ package Object::Remote::ModuleSender; +use Object::Remote::Logging qw( :log :dlog ); use Config; use File::Spec; use List::Util qw(first); @@ -11,22 +12,26 @@ sub _build_dir_list { my %core = map +($_ => 1), grep $_, @Config{ qw(privlibexp archlibexp vendorarchexp sitearchexp) }; - [ grep !/\Q$Config{archname}/, grep !/\Q$Config{myarchname}/, grep !$core{$_}, @INC ]; + DlogS_trace { "dir list built in ModuleSender: $_" } [ grep !$core{$_}, @INC ]; } sub source_for { my ($self, $module) = @_; + log_debug { "locating source for module '$module'" }; if (my $find = Object::Remote::FromData->can('find_module')) { if (my $source = $find->($module)) { + Dlog_trace { "source of '$module' was found by Object::Remote::FromData" }; return $source; } } + log_trace { "Searching for module in library directories" }; my ($found) = first { -f $_ } map File::Spec->catfile($_, $module), @{$self->dir_list}; die "Couldn't find ${module} in remote \@INC. dir_list contains:\n" .join("\n", @{$self->dir_list}) unless $found; + log_debug { "found '$module' at '$found'" }; open my $fh, '<', $found or die "Couldn't open ${found} for ${module}: $!"; return do { local $/; <$fh> }; }