When I authored commit
2c3743704, I thought I was just correcting the
error message at the time (from ‘Not a CODE reference’ to ‘Undefined
sub called’, since there is a sub), but it turns out I actually fixed
another bug at the same time. Undefined anonymous subs were falling
back to supposedly-autoloaded __ANON__ subs.
Take this example, for instance:
sub __ANON__ { warn 42 }
$x = sub {};
undef &$x;
$x->();
This is the output I get:
$ pbpaste|perl5.14.0
42 at - line 1.
$ pbpaste|perl5.16.0
Undefined subroutine called at - line 4.
ok 1
########
# [perl #71154] undef &$code makes $code->() die with: Not a CODE reference
+sub __ANON__ { print "42\n" }
undef &{$x=sub{}};
$x->();
EXPECT
-Undefined subroutine called at - line 3.
+Undefined subroutine called at - line 4.