CC: | perl5-porters [...] perl.org |
Subject: | Bleadperl f132ae69 breaks Class::Sniff |
A change in perl 5.6.0 inadvertently caused perl to be inconsistent with regard to *{$undef}.
Before that, *{$undef} would always die with ‘Can’t use an undefined value...’. In 5.6.0, it would
only *usually* do that. If the undefined happened to be the one returned by the ‘undef’
operator, which is also returned by other operations such as nonexistent hash elements, it would
be treated as *{""}.
I fixed this inconsistency in bleadperl with commit f132ae69, restoring the pre-5.6 behaviour,
but it breaks your module.
I hope you will agree that this is a bug.
Attached is a patch to Class::Sniff. I used a separate $stash variable for speed.
Subject: | open_xb9i4qE9.txt |
diff -rup Class-Sniff-0.09-68kpJC-orig/lib/Class/Sniff.pm Class-Sniff-0.09-68kpJC/lib/Class/Sniff.pm
--- Class-Sniff-0.09-68kpJC-orig/lib/Class/Sniff.pm 2011-11-03 17:57:14.000000000 -0700
+++ Class-Sniff-0.09-68kpJC/lib/Class/Sniff.pm 2011-11-03 18:01:31.000000000 -0700
@@ -1128,8 +1128,9 @@ sub _is_real_package {
return 1 if 'UNIVERSAL' eq $class;
return
unless eval {
- defined *{ ${"${class}::"}{ISA} }{ARRAY}
- || scalar grep { defined *{$_}{CODE} } values %{"$class\::"};
+ my $stash = \%{"$class\::"};
+ defined $stash->{ISA} && defined *{ $stash->{ISA} }{ARRAY}
+ || scalar grep { defined *{$_}{CODE} } values %$stash;
};
}