in reply to "cleaning out" object data
Then you can just call $self->_init; whenever you wish to reset the data.sub new { my $class = shift; my $self = {}; bless($self, $class); $self->_init; return $self; } sub _init { my $self = shift; foreach my $key (keys(%{$self})) { delete $self->{$key}; } $self->{hours_on_the_job} = 0; $self->{people_shot} = 0; etc... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: "cleaning out" object data
by jhourcle (Prior) on May 20, 2005 at 13:35 UTC | |
by aukjan (Friar) on May 20, 2005 at 13:53 UTC |