diff options
author | Jesse Luehrs <doy@tozt.net> | 2010-10-27 13:13:40 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2010-10-27 13:14:29 -0500 |
commit | b10a21db5360fcf9e07440ee9d1dc36031be572b (patch) | |
tree | 345a8d9704008836df353f57ec397004a4a2eaa2 | |
parent | 614505f13f0700890630c7735d29fde1b7a2ebcb (diff) | |
download | package-stash-b10a21db5360fcf9e07440ee9d1dc36031be572b.tar.gz package-stash-b10a21db5360fcf9e07440ee9d1dc36031be572b.zip |
actually, only do the weird special casing on broken perl versions0.10
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | lib/Package/Stash.pm | 18 |
2 files changed, 13 insertions, 6 deletions
@@ -1,6 +1,7 @@ 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 diff --git a/lib/Package/Stash.pm b/lib/Package/Stash.pm index f708bbc..6c361c1 100644 --- a/lib/Package/Stash.pm +++ b/lib/Package/Stash.pm @@ -6,6 +6,9 @@ use warnings; 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 @@ -233,12 +236,15 @@ sub get_package_symbol { 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, {}); |