Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 rats come out to play...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2017-02-23 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (347 votes). Check out past polls.