in reply to Re^2: "cleaning out" object data
in thread "cleaning out" object data

Ok, then you don't want to completely delete your instance vars. You want to reset the values of those vars to empty:
sub reset_me { my $self = shift; $self->{known_nicks} = {}; $self->{known_channelnames} = {}; }
In fact, you can use that code during your initialization as well. Then when you add a new instance var, you'll have a clean place to initialize it for everyone.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.


update: And as an afterthought, this will also permit your class to be reused for subclasses more directly, since you won't be accidentally clearing out variables that your subclasses need to retain.

Replies are listed 'Best First'.
Re^4: "cleaning out" object data
by Forsaken (Friar) on May 20, 2005 at 14:25 UTC
    Sounds like an excellent approach, think I just might do it that way.

    Disclaimer 1: this was more of a "hmm, wonder how this would work, let's see if the monks know" kinda question than a real "omg, I *MUST* know this in order to be able to progress" kinda thing.
    Disclaimer 2: I'm a big boy. Although it could have been phrased differently merlyn's original questions were perfectly valid.

    Remember rule one...