Subject: | [PATCH] Compatibility with CV-in-stash optimisation |
See the attached patch. From the perldelta for 5.27.6:
=head2 Subroutines no longer need typeglobs
Perl 5.22.0 introduced an optimization allowing subroutines to be stored in
packages as simple sub refs, not requiring a full typeglob (thus
potentially saving large amounts of memeory). However, the optimization
was flawed: it only applied to the main package.
This optimization has now been extended to all packages. This may break
compatibility with introspection code that looks inside stashes and expects
everything in them to be a typeglob.
When this optimization happens, the typeglob still notionally exists, so
accessing it will cause the stash entry to be upgraded to a typeglob. The
optimization does not apply to XSUBs or exported subroutines, and calling a
method will undo it, since method calls cache things in typeglobs.
[perl #129916] [perl #132252]
Subject: | open_YcyQUmWT.txt |
diff -rup Class-Declare-Attributes-0.12-0/Attributes.pm Class-Declare-Attributes-0.12-1/Attributes.pm
--- Class-Declare-Attributes-0.12-0/Attributes.pm 2016-12-03 06:53:05.000000000 -0800
+++ Class-Declare-Attributes-0.12-1/Attributes.pm 2017-11-18 11:53:50.000000000 -0800
@@ -168,13 +168,20 @@ sub __init__
foreach my $name ( @names ) {
no warnings 'once';
- # if we don't have a normal symbol table entry, then skip
- # - occasionally we will find a reference here not a GLOB
+ # if we don't have a normal symbol table entry or a CODE ref
+ # then skip
+ # - occasionally we will find another reference type here
my $sym = ${ $pkg_ }{ $name };
+ my $ref;
+ if ( ref $sym eq 'CODE') {
+ $ref = $sym;
+ }
+ else {
+ # if we don't have a CODE reference then we can't proceed
( ref $sym ) and next;
+ $ref = *{ $sym }{ CODE } or next;
+ }
- # if we don't have a CODE reference then we can't proceed
- my $ref = *{ $sym }{ CODE } or next;
my @attr = grep { defined } attributes::get( $ref );
# filter attributes that don't belong to the list fo C::D attributes