From: Ovid <po...@ya...> - 2003-08-04 20:18:14
|
--- Perrin Harkins <pe...@el...> wrote: > My first guess would just be standard issue accessors: > > sub foo { my $self = shift; return $self->{'foo'}; } > sub set_foo { my ($self, $val) = @_; $self->{'foo'} = $val; } > > This violates encapsulation in that you need to know how the parent > class is implemented, but that is the nature of subclassing in Perl. You are correct that it violates encapsulation and I'd rather not create a potential maintenance problem. This maintenance problem is increased because I'm sitting in Vermont writing code on contract and when I leave, I don't want to have a timebomb waiting to go off -- at least, not one that I know about :) My code is already somewhat fragile due to incomplete specs that I've been asked to "guess" about. It's bad enough that I've convinced them to upgrade Class::DBI for me (and they're now maintaining two versions of it because of this. Ingy's "only.pm" rocks!) Cheers, Ovid ===== Silence is Evil http://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/ __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com |