Skip Menu |

This queue is for tickets about the base CPAN distribution.

Report information
The Basics
Id: 83872
Status: rejected
Priority: 0/
Queue: base

People
Owner: Nobody in particular
Requestors: haarg [...] haarg.org
tsibley [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: failures loading modules are ignored when sub-package exists
When base tries to load a module and finds that it doesn't exist, it ignores the error if anything the package's stash exists. This is by design, but causes issues when sub-packages exist. Attached is a patch that will ignore sub-packages, while still considering anything else in the stash as marking the package's existence.
Subject: sub-package-fix.patch
diff --git i/lib/base.pm w/lib/base.pm index 19fc845..1d3db87 100644 --- i/lib/base.pm +++ w/lib/base.pm @@ -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 i/t/base.t w/t/base.t old mode 100644 new mode 100755 index 6fb24ea..705ed8f --- i/t/base.t +++ w/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 };
@haarg, why did you mark this resolved? It still seems to be an issue in the latest version from core (2.22), and something I just ran into for the first time.
On Wed Apr 08 01:24:41 2015, TSIBLEY wrote: Show quoted text
> @haarg, why did you mark this resolved? It still seems to be an issue > in the latest version from core (2.22), and something I just ran into > for the first time.
It was rejected by p5p.
The relevant rt.perl.org bug is now linked from this ticket: https://rt.perl.org/Public/Bug/Display.html?id=118561