Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Answer: How do I make a destructor?

by nite_man (Deacon)
on Feb 10, 2003 at 08:48 UTC ( #234053=categorized answer: print w/replies, xml ) Need Help??

Q&A > object-oriented programming > How do I make a destructor? - Answer contributed by nite_man

You can create a descructor like this:
sub DESTROY{ my $self = shift; $self->coun_decr(); bless $self, $ISA[0]; }
But before, you should define a object counter and methods for management it:
my $inst_count = 0; sub get_inst_count { $inst_count } sub _incr_inst_count { ++$inst_count } sub _decr_inst_count { --$inst_count }

Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2016-10-24 19:37 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (309 votes). Check out past polls.