Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: DESTROYing an object

by adrianh (Chancellor)
on Dec 11, 2002 at 21:38 UTC ( [id://219182]=note: print w/replies, xml ) Need Help??


in reply to DESTROYing an object

It will just call the destroy method and return. For example this:

sub Foo::DESTROY { my $self = shift; print "destroying $self\n" }; my $foo = bless {}, "Foo"; $foo->DESTROY; print "foo is $foo\n";
will produce
destroying Foo=HASH(0x4759c) foo is Foo=HASH(0x4759c) destroying Foo=HASH(0x4759c)

The first "destroying" comes from the explicit call to the method. The second by the method being called before the object is garbage collected.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://219182]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-19 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found