summaryrefslogtreecommitdiff
path: root/dist/base
diff options
context:
space:
mode:
authorGraham Knop <haarg@haarg.org>2013-06-24 17:58:46 -0400
committerTony Cook <tony@develop-help.com>2013-06-25 11:59:00 +1000
commitc4f21d8bae2372c750ff63b7e5df47996baa1f39 (patch)
tree9616b3ccccf9c81a17dd15279583c2f6229670e5 /dist/base
parentd16269d8356f921e8939320f5cfd7d08d130c078 (diff)
downloadperl-c4f21d8bae2372c750ff63b7e5df47996baa1f39.tar.gz
[perl #118561] failures loading modules are ignored when sub-package exists
Diffstat (limited to 'dist/base')
-rw-r--r--dist/base/lib/base.pm4
-rw-r--r--dist/base/t/base.t7
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 };