summaryrefslogtreecommitdiffstats
path: root/lib/Package/Stash.pm
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-10-27 13:13:40 -0500
committerJesse Luehrs <doy@tozt.net>2010-10-27 13:14:29 -0500
commitb10a21db5360fcf9e07440ee9d1dc36031be572b (patch)
tree345a8d9704008836df353f57ec397004a4a2eaa2 /lib/Package/Stash.pm
parent614505f13f0700890630c7735d29fde1b7a2ebcb (diff)
downloadpackage-stash-b10a21db5360fcf9e07440ee9d1dc36031be572b.tar.gz
package-stash-b10a21db5360fcf9e07440ee9d1dc36031be572b.zip
actually, only do the weird special casing on broken perl versions0.10
Diffstat (limited to 'lib/Package/Stash.pm')
-rw-r--r--lib/Package/Stash.pm18
1 files changed, 12 insertions, 6 deletions
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, {});