On Wed Dec 09 14:42:07 2009, nicholas wrote: > $ ./perl -e '$a = sub {}; warn "Before: $a"; undef &$a; warn "After > $a"; $a->()' > Before: CODE(0x100815848) at -e line 1. > After CODE(0x100815848) at -e line 1. > Not a CODE reference at -e line 1. > > only it sure does look like a CODE reference. I fixed that to produce a sensible error message in commit 2c3743704, which is in 5.16. What I did not realise was that the problem actually went further (and my commit fixed this, too): sub __ANON__ { warn 42 } $x = sub {}; undef &$x; $x->(); With 5.14.0: 42 at - line 1. With 5.16.0: Undefined subroutine called at - line 4. So I have improved the test with commit 12f98b43fb8, which makes sure __ANON__() is not called. But the problem goes even deeper than that. This ‘Not a CODE reference’ error was occurring whenever an already-autoloaded subroutine was looked for when calling a stub, if the GV had no CV in it. Compare: $ perl5.16.0 -e ' my $foosub = \&foo; &$foosub; ' Undefined subroutine &main::foo called at -e line 3. $ perl5.16.0 -e ' my $foosub = \&foo; undef *foo; &$foosub; ' Not a CODE reference at -e line 4. So I have just fixed that now with commit c220e1a11e. -- Father Chrysostomos --- via perlbug: queue: perl5 status: resolved https://rt.perl.org:443/rt3/Ticket/Display.html?id=71154