Skip Menu |

This queue is for tickets about the Devel-ModuleBreaker CPAN distribution.

Report information
The Basics
Id: 124240
Status: resolved
Priority: 0/
Queue: Devel-ModuleBreaker

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

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



Subject: [PATCH] Compatibility with CV-in-stash optimisation
Since perl 5.6 or so, stash entries have not always been typeglobs. Your module fails to take this into account, and so it fails with the sub optimization that will be included in 5.28: The attached patch changes ModuleBreaker.pm to take this into account. Basically, if you don’t have a typeglob, you can still access the symbol by name using symbol references. I also changed the string eval into a symbolic reference, since the latter is faster and less error prone. From perl5276delta: =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. (This change actually happened in perl 5.27.5 but was omitted from its perldelta.)
Subject: open_9ShgTMRf.txt
diff -rup Devel-ModuleBreaker-0.01-0-orig/blib/lib/Devel/ModuleBreaker.pm Devel-ModuleBreaker-0.01-0/blib/lib/Devel/ModuleBreaker.pm --- Devel-ModuleBreaker-0.01-0-orig/blib/lib/Devel/ModuleBreaker.pm 2018-01-16 11:53:58.000000000 -0800 +++ Devel-ModuleBreaker-0.01-0/blib/lib/Devel/ModuleBreaker.pm 2018-01-27 07:21:55.000000000 -0800 @@ -7,8 +7,8 @@ sub import { CHECK { for my $module (our @modules) { no strict 'refs'; - defined &$_ and DB::cmd_b_sub(substr($_,1)) - for eval "values %" . $module . "::"; + defined &{"$module:\:$_"} and DB::cmd_b_sub("$module:\:$_") + for keys %{"$module:\:"}; } } 1; diff -rup Devel-ModuleBreaker-0.01-0-orig/lib/Devel/ModuleBreaker.pm Devel-ModuleBreaker-0.01-0/lib/Devel/ModuleBreaker.pm --- Devel-ModuleBreaker-0.01-0-orig/lib/Devel/ModuleBreaker.pm 2018-01-16 11:53:58.000000000 -0800 +++ Devel-ModuleBreaker-0.01-0/lib/Devel/ModuleBreaker.pm 2018-01-27 07:21:55.000000000 -0800 @@ -7,8 +7,8 @@ sub import { CHECK { for my $module (our @modules) { no strict 'refs'; - defined &$_ and DB::cmd_b_sub(substr($_,1)) - for eval "values %" . $module . "::"; + defined &{"$module:\:$_"} and DB::cmd_b_sub("$module:\:$_") + for keys %{"$module:\:"}; } } 1;
Patch applied in v0.02