The attached patch gets the Clownfish CPAN distribution working with perl 
5.27.6.  The code that my patch changes was already subtly wrong: references in 
stashes, which have been put there by constant.pm since perl 5.10, do represent 
callable methods.  So anything that is a reference should be added to the list 
of methods.  On account of the change cited below, Clownfish now fails its 
tests with bleadperl.

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]
diff -rup Clownfish-0.6.1-0/lib/Clownfish.pm Clownfish-0.6.1-1/lib/Clownfish.pm
--- Clownfish-0.6.1-0/lib/Clownfish.pm  2017-11-18 14:37:15.000000000 -0800
+++ Clownfish-0.6.1-1/lib/Clownfish.pm  2017-11-18 14:36:54.000000000 -0800
@@ -81,8 +81,7 @@ sub error {$Clownfish::Err::error}
         my $methods
             = Clownfish::Vector->new( capacity => scalar keys %$stash );
         while ( my ( $symbol, $glob ) = each %$stash ) {
-            next if ref $glob;
-            next unless *$glob{CODE};
+            next unless ref $glob || *$glob{CODE};
             $methods->push( Clownfish::String->new($symbol) );
         }
         return $methods;

Reply via email to