Skip Menu |

This queue is for tickets about the Symbol-Global-Name CPAN distribution.

Report information
The Basics
Id: 123661
Status: new
Priority: 0/
Queue: Symbol-Global-Name

People
Owner: Nobody in particular
Requestors: 'spro^^*%*^6ut# [...] &$%*c
Cc: cpan [...] chmrr.net
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: cpan [...] chmrr.net
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_TqFO08Y1.txt
diff -rup Symbol-Global-Name-0.05-1/lib/Symbol/Global/Name.pm Symbol-Global-Name-0.05-0/lib/Symbol/Global/Name.pm --- Symbol-Global-Name-0.05-1/lib/Symbol/Global/Name.pm 2014-02-13 12:41:49.000000000 -0800 +++ Symbol-Global-Name-0.05-0/lib/Symbol/Global/Name.pm 2017-11-17 13:41:57.000000000 -0800 @@ -101,14 +101,17 @@ sub _find { # list constants are also inlined. Notably, ref(GLOB) is # undef, but inlined constants are currently either REF, # SCALAR, or ARRAY. - next if ref($entry); + # Note also that in perl 5.28 subroutines themselves may be + # stored directly as coderefs in the stash. + my $entry_ref_type = ref($entry); + next if $entry_ref_type && $entry_ref_type ne 'CODE'; my $ref_type = ref($ref); # regex/arrayref/hashref/coderef are stored in SCALAR glob $ref_type = 'SCALAR' if $ref_type eq 'REF'; - my $entry_ref = *{$entry}{ $ref_type }; + my $entry_ref = $entry_ref_type ? $entry : *{$entry}{ $ref_type }; next if ref $entry_ref && ref $entry_ref ne ref $ref; next unless $entry_ref;