This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #127494] don't cache AUTOLOAD as DESTROY
authorTony Cook <tony@develop-help.com>
Wed, 10 Feb 2016 03:30:08 +0000 (14:30 +1100)
committerTony Cook <tony@develop-help.com>
Wed, 10 Feb 2016 03:30:44 +0000 (14:30 +1100)
commit958cdeac409681891afe77bf60db047296523465
tree81526b189a59bea3f61e76d2497a838c3e174c26
parent7db8c4f1f19e6f855107ec990507a1a9cb0f59a6
[perl #127494] don't cache AUTOLOAD as DESTROY

Otherwise S_curse() would need to do all the work gv_autoload_pvn()
already does to set up to call AUTOLOAD() (setting $AUTOLOAD etc.)

Instead, by not caching it, we ensure gv_autoload_pvn() is called
each time to perform the required setup.

This has a performance cost over adding that code to S_curse(), but the
cost of actually running the AUTOLOAD sub is likely to drown that out,
and is easily avoided by adding "sub DESTROY {}" to the module.
sv.c
t/op/method.t