Revision history for Package-Stash
{{$NEXT}}
+ - only do the weird ISA special-casing on perl versions where it's broken
0.09 2010-10-27
- clean up the vivication code a lot, make it behave more sanely
use Carp qw(confess);
use Scalar::Util qw(reftype);
use Symbol;
+# before 5.12, assigning to the ISA glob would make it lose its magical ->isa
+# powers
+use constant BROKEN_ISA_ASSIGNMENT => ($] < 5.012);
=head1 SYNOPSIS
if (!exists $namespace->{$name}) {
if ($opts{vivify}) {
if ($type eq 'ARRAY') {
- $self->add_package_symbol(
- $variable,
- # setting our own arrayref manually loses the magicalness
- # or something
- $name eq 'ISA' ? () : ([])
- );
+ if (BROKEN_ISA_ASSIGNMENT) {
+ $self->add_package_symbol(
+ $variable,
+ $name eq 'ISA' ? () : ([])
+ );
+ }
+ else {
+ $self->add_package_symbol($variable, []);
+ }
}
elsif ($type eq 'HASH') {
$self->add_package_symbol($variable, {});