in reply to Strange code execution with 'AUTOLOAD'
DESTROY is the destructor for the class. If you use AUTOLOAD
but not DESTROY, you will get the above error message, because
AUTOLOAD is called for the DESTROY method (because AUTOLOAD
catches all undefined method calls on the object), and you
do not have a DESTROY method to call.
Since you have Object Oriented Perl, I suggest you look at page 112, at the section "Destructors and autoloading". It explains the situation far better than I can, and offers a solution (actually, two).
For those who don't have the book :), the best solution is to define an empty DESTROY method in your class:
The existence of this method will prevent AUTOLOAD from being called on object destruction.sub DESTROY { }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Strange code execution with 'AUTOLOAD'
by DrZaius (Monk) on Jul 01, 2001 at 23:40 UTC | |
by btrott (Parson) on Jul 02, 2001 at 04:38 UTC |
In Section
Seekers of Perl Wisdom