From: Graham Knop Date: Mon, 23 May 2016 13:16:07 +0000 (-0400) Subject: Allow base.pm to be used with packages that don't exist on dist X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=commitdiff_plain;h=48816a637a319cf23115f106c85ef99ecc352879 Allow base.pm to be used with packages that don't exist on dist If a module doesn't exist, base.pm will ignore the error if the namespace has subs in it. The detection for modules not existing depends on the error message, and sometimes involves checking the filename (depending on perl version). Detect this case and give it an appropriate filename. --- diff --git a/lib/Object/Remote/ModuleLoader.pm b/lib/Object/Remote/ModuleLoader.pm index 43a3a38..15c1c31 100644 --- a/lib/Object/Remote/ModuleLoader.pm +++ b/lib/Object/Remote/ModuleLoader.pm @@ -22,6 +22,10 @@ BEGIN { if ($@) { log_trace { "Module sender blew up - $@" }; if ($@ =~ /Can't locate/) { + my @caller = caller(0); + if ($caller[0] eq 'base') { + $@ =~ s/(in \@INC.)/$1 at $caller[1] line $caller[2]/; + } # Fudge the error messge to make it work with # Module::Runtime use_package_optimistically # Module::Runtime wants - /\ACan't locate \Q$fn\E .+ at \Q@{[__FILE__]}\E line/