The problem is you are using a package-scoped variable ($_name) to store instance data instead of storing it in the object itself. Your methods should be closer to
See perltoot for a tutorial of Perl OOP.sub myNameIs{ my ($this,$name) = @_; die("Don't tell me that I don't have a name.") unless(defined($nam +e)); $this->{_name} = $name; } sub whoAmI{ my $this = shift; return($this->{_name}); }
the lowliest monk
In reply to Re: OO doesn't seem to play nice with multiple instances
by tlm
in thread OO doesn't seem to play nice with multiple instances
by krisahoch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |