summaryrefslogtreecommitdiff
path: root/dist/base
diff options
context:
space:
mode:
authorDavid Golden <dagolden@cpan.org>2011-09-22 13:33:06 -0400
committerDavid Golden <dagolden@cpan.org>2011-09-22 13:38:06 -0400
commit7a799f6bb3cac2e1bf9bede83579324cffa59c16 (patch)
tree11262edc9e46026eebf36281b64cfd602cfc690a /dist/base
parent0dcb3d887131a644381d6660eb13e2436e609eb9 (diff)
downloadperl-7a799f6bb3cac2e1bf9bede83579324cffa59c16.tar.gz
base.pm no longer tracks loaded modules
Tracking modules loaded by base.pm to avoid reloading them means that any module that wishes to force a reload can't just modify %INC but must also interact with base.pm to clear its cache. Removing the module-loaded checks have minimal impact. The internal call to require() is a NOP for a loaded module. For an internal package, the require() will fail with the same error message as before, which base.pm then ignores. Tracking modules loaded to avoid this slight extra overhead is not worth the complexity for other modules that wish to manipulate %INC.
Diffstat (limited to 'dist/base')
-rw-r--r--dist/base/lib/base.pm8
1 files changed, 2 insertions, 6 deletions
diff --git a/dist/base/lib/base.pm b/dist/base/lib/base.pm
index b3443d447c..23e7084d8e 100644
--- a/dist/base/lib/base.pm
+++ b/dist/base/lib/base.pm
@@ -55,8 +55,6 @@ else {
}
}
-my %loaded; # track modules loaded via base.pm
-
sub import {
my $class = shift;
@@ -76,7 +74,8 @@ sub import {
next if grep $_->isa($base), ($inheritor, @bases);
- if (! $loaded{$base}) {
+ # Following blocks help isolate $SIG{__DIE__} changes
+ {
my $sigdie;
{
local $SIG{__DIE__};
@@ -97,7 +96,6 @@ ERROR
}
# Make sure a global $SIG{__DIE__} makes it out of the localization.
$SIG{__DIE__} = $sigdie if defined $sigdie;
- $loaded{$base}++;
}
push @bases, $base;
@@ -212,8 +210,6 @@ the filename does not match the base module name, like so:
There is no F<Foo.pm>, but because C<Foo> defines a symbol (the C<exclaim>
subroutine), C<base> will not die when the C<require> fails to load F<Foo.pm>.
-C<base> keeps track of modules that were successfully used as a base and will
-not C<require> them again.
C<base> will also initialize the fields if one of the base classes has it.
Multiple inheritance of fields is B<NOT> supported, if two or more base classes