sub _load_if_possible {
my ($class) = @_;
- eval "require $class";
+ use_module($class);
if ($@) {
log_debug { "Attempt at loading '$class' failed with '$@'" };
use strictures 1;
-use Log::Contextual qw( :log );
use Object::Remote::LogRouter;
-use Object::Remote::LogDestination;
+use Object::Remote::LogDestination;
use Log::Contextual::SimpleLogger;
use Carp qw(cluck);
BEGIN {
package Object::Remote::ModuleLoader::Hook;
use Moo;
- use Object::Remote::Logging qw(:log);
+ use Object::Remote::Logging qw( :log :dlog );
has sender => (is => 'ro', required => 1);
# unqualified INC forced into package main
log_debug { "Loading $module via " . ref($self) };
if (my $code = $self->sender->source_for($module)) {
open my $fh, '<', \$code;
+ Dlog_trace { "Module sender successfully sent code for '$module': $code" } $code;
return $fh;
}
+ log_trace { "Module sender did not return code for '$module'" };
return;
}
}
log_debug { "locating source for module '$module'" };
if (my $find = Object::Remote::FromData->can('find_module')) {
if (my $source = $find->($module)) {
- return Dlog_trace { "Object::Remote::FromData->find_module('$module') returned '$_'" } $source;
+ Dlog_trace { "Object::Remote::FromData->find_module('$module') returned '$_'" } $source;
+ return $source;
}
}
log_trace { "Searching for module in library directories" };
if (defined($given_stderr)) {
#if the stderr data goes to an existing file handle
- #an need an anonymous file handle is required
+ #an anonymous file handle is required
#as the other half of a pipe style file handle pair
#so the file handles can go into the run loop
$foreign_stderr = gensym();
package Object::Remote::Role::LogForwarder;
use Moo::Role;
-use Object::Remote::Logging;
use Scalar::Util qw(weaken);
use Carp qw(cluck);