Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2016-09-29 07:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (550 votes). Check out past polls.