This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #118561] failures loading modules are ignored when sub-package exists
authorGraham Knop <haarg@haarg.org>
Mon, 24 Jun 2013 21:58:46 +0000 (17:58 -0400)
committerTony Cook <tony@develop-help.com>
Tue, 25 Jun 2013 01:59:00 +0000 (11:59 +1000)
AUTHORS
dist/base/lib/base.pm
dist/base/t/base.t

diff --git a/AUTHORS b/AUTHORS
index 107f7b2..13f0c15 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -414,6 +414,7 @@ Gordon J. Miller            <gjm@cray.com>
 Goro Fuji                      <gfuji@cpan.org>
 Grace Lee                      <grace@hal.com>
 Graham Barr                    <gbarr@pobox.com>
+Graham Knop                    <haarg@haarg.org>
 Graham TerMarsch               <graham@howlingfrog.com>
 Grant McLean                   <grantm@cpan.org>
 Greg Bacon                     <gbacon@itsc.uah.edu>
index 19fc845..446ac16 100644 (file)
@@ -2,7 +2,7 @@ package base;
 
 use strict 'vars';
 use vars qw($VERSION);
-$VERSION = '2.18';
+$VERSION = '2.19';
 $VERSION = eval $VERSION;
 
 # constant.pm is slow
@@ -82,7 +82,7 @@ sub import {
                 # Only ignore "Can't locate" errors from our eval require.
                 # Other fatal errors (syntax etc) must be reported.
                 die if $@ && $@ !~ /^Can't locate .*? at \(eval /;
-                unless (%{"$base\::"}) {
+                unless (grep { !/::$/ } keys %{"$base\::"}) {
                     require Carp;
                     local $" = " ";
                     Carp::croak(<<ERROR);
index 6fb24ea..705ed8f 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 
 use strict;
-use Test::More tests => 11;
+use Test::More tests => 12;
 
 use_ok('base');
 
@@ -55,6 +55,11 @@ like( $@, qr/^Base class package "reallyReAlLyNotexists" is empty\./,
 eval q{use base 'reallyReAlLyNotexists'};
 like( $@, qr/^Base class package "reallyReAlLyNotexists" is empty\./,
                                           '  still empty on 2nd load');
+eval 'sub reallyReAlLyNotexists::Sub::welp { }';
+eval q{use base 'reallyReAlLyNotexists'};
+like( $@, qr/^Base class package "reallyReAlLyNotexists" is empty\./,
+    '  empty even with sub-package existing');
+
 {
     my $warning;
     local $SIG{__WARN__} = sub { $warning = shift };