X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlobj.pod;h=6d335e5410053414580c9716763c0b122c29f7f9;hb=c1effa61278e47c916466883d74905b04fedc388;hp=44ae4535ab39e49bc95f92f41efaec4464f25b4b;hpb=003db2bd2e42353866adbc9b4f1ad5f829a2b43b;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlobj.pod b/pod/perlobj.pod index 44ae453..6d335e5 100644 --- a/pod/perlobj.pod +++ b/pod/perlobj.pod @@ -460,6 +460,15 @@ object destruction, or for ensuring that destructors in the base classes of your choosing get called. Explicitly calling DESTROY is also possible, but is usually never needed. +DESTROY is subject to AUTOLOAD lookup, just like any other method. Hence, if +your class has an AUTOLOAD method, but does not need any DESTROY actions, +you probably want to provide a DESTROY method anyway, to prevent an +expensive call to AUTOLOAD each time an object is freed. As this technique +makes empty DESTROY methods common, the implementation is optimised so that +a DESTROY method that is an empty or constant subroutine, and hence could +have no side effects anyway, is not actually called. +X X + Do not confuse the previous discussion with how objects I in the current one are destroyed. Such objects will be freed and destroyed automatically when the current object is freed, provided no other references to them exist