Make @INC available in base.pm's error message when
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Wed, 12 Sep 2007 09:32:47 +0000 (09:32 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Wed, 12 Sep 2007 09:32:47 +0000 (09:32 +0000)
a module can't be found. See CPAN bug #28582.

p4raw-id: //depot/perl@31853

lib/base.pm
lib/base/t/base.t

index 9649e8a..fc0f7f9 100644 (file)
@@ -92,9 +92,11 @@ sub import {
                 die if $@ && $@ !~ /^Can't locate .*? at \(eval /;
                 unless (%{"$base\::"}) {
                     require Carp;
+                    local $" = " ";
                     Carp::croak(<<ERROR);
 Base class package "$base" is empty.
-    (Perhaps you need to 'use' the module which defines that package first.)
+    (Perhaps you need to 'use' the module which defines that package first,
+    or make that module available in \@INC (\@INC contains: @INC).
 ERROR
                 }
                 $sigdie = $SIG{__DIE__};
index 8a9f3ea..68dbea0 100644 (file)
@@ -56,11 +56,11 @@ is( $Eval2::VERSION, 1.02 );
 
 
 eval q{use base 'reallyReAlLyNotexists'};
-like( $@, qr/^Base class package "reallyReAlLyNotexists" is empty./,
+like( $@, qr/^Base class package "reallyReAlLyNotexists" is empty\./,
                                           'base with empty package');
 
 eval q{use base 'reallyReAlLyNotexists'};
-like( $@, qr/^Base class package "reallyReAlLyNotexists" is empty./,
+like( $@, qr/^Base class package "reallyReAlLyNotexists" is empty\./,
                                           '  still empty on 2nd load');
 {
     my $warning;