in reply to AUTOLOAD question

And if you do still decide to use AUTOLOAD, be sure and "define" a dummy DESTROY method:
sub DESTROY {}
So that you don't get an extra AUTOLOAD "hit" when your object dies, such as with this code:
package Foo; our $AUTOLOAD; sub new {bless {}, shift} sub AUTOLOAD { my $self = shift; my ($method) = $AUTOLOAD =~ /([^:]+)$/; # no need for s/// print "$method was called\n"; } package main; new Foo;

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^2: AUTOLOAD question
by adrianh (Chancellor) on Dec 01, 2003 at 00:22 UTC
    And if you do still decide to use AUTOLOAD, be sure and "define" a dummy DESTROY method:

    Using NEXT::DESTROY if you think a super-class might have their own destroy method :-)