diff options
Diffstat (limited to 'dist/base')
-rw-r--r-- | dist/base/lib/base.pm | 4 | ||||
-rw-r--r-- | dist/base/t/base.t | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/dist/base/lib/base.pm b/dist/base/lib/base.pm index 19fc8456d2..446ac16592 100644 --- a/dist/base/lib/base.pm +++ b/dist/base/lib/base.pm @@ -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); diff --git a/dist/base/t/base.t b/dist/base/t/base.t index 6fb24ea308..705ed8ff1a 100644 --- a/dist/base/t/base.t +++ b/dist/base/t/base.t @@ -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 }; |