perl5db.pl: ensure PadWalker is loaded from standard paths
authorTony Cook <tony@develop-help.com>
Thu, 23 Jun 2016 00:41:48 +0000 (10:41 +1000)
committerTony Cook <tony@develop-help.com>
Tue, 26 Jul 2016 05:36:32 +0000 (15:36 +1000)
lib/perl5db.pl

index f26731b..99566a7 100644 (file)
@@ -1951,7 +1951,10 @@ sub _DB__handle_y_command {
         = $obj->cmd_args =~ /\A(?:(\d*)\s*(.*))?\z/) {
 
         # See if we've got the necessary support.
-        if (!eval { require PadWalker; PadWalker->VERSION(0.08) }) {
+        if (!eval {
+            local @INC = @INC;
+            pop @INC if $INC[-1] eq '.';
+            require PadWalker; PadWalker->VERSION(0.08) }) {
             my $Err = $@;
             _db_warn(
                 $Err =~ /locate/
@@ -9441,7 +9444,10 @@ if PadWalker could be loaded.
 
 =cut
 
-        if (not $text =~ /::/ and eval { require PadWalker } ) {
+        if (not $text =~ /::/ and eval {
+            local @INC = @INC;
+            pop @INC if $INC[-1] eq '.';
+            require PadWalker } ) {
             my $level = 1;
             while (1) {
                 my @info = caller($level);