If that bothers you, just treat the object as a handle used to get at your real implementation:
package My::Class; our @ISA=qw(Base::Class); my %obj; sub new { ... my $h=$class->SUPER::new; $obj{$h}{host}=shift; $obj{$h}{port}=shift; ... } sub DESTROY { my $h=shift; delete $obj{$h}; $h->SUPER::DESTROY; }
Now Base::Class could change to using a tied filehandle as its implementation, for all you care.
The reality is that most classes you would want to subclass are designed to make it safe, and even if they aren't there are a few simple measures you can take (like prefixing your subclass's keys with your module's name). And Perl is more than flexible enough for you to do things completely safely if you're really worried.
=cut
--Brent Dax
There is no sig.
In reply to Re^2: Is Perl Truly an Object Oriented Language?
by BrentDax
in thread Is Perl Truly an Object Oriented Language?
by awohld
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |