develooper Front page | perl.ldap | Postings from April 2003

Re: Subclass proposal: Net::LDAP::Simple

Thread Previous | Thread Next
From:
Graham Barr
Date:
April 29, 2003 08:23
Subject:
Re: Subclass proposal: Net::LDAP::Simple
Message ID:
20030429162337.J17850@pobox.com
On Tue, Apr 29, 2003 at 05:09:45PM +0200, Marco Marongiu wrote:
> Graham Barr wrote:
> > On Mon, Apr 28, 2003 at 12:53:55PM +0200, Marco Marongiu wrote:
> > If there is one thing that concerns me is that it is implemented
> > by inheritance.  inheritance is usually, in my experience, used to
> > extend functionality of a class. But in this case you are changing
> > it. By that I mean you have overridden methods and changed their
> > functionality by changing the return type.
> > 
> > What I would suggest is that the Net::LDAP object become a property
> > of your object and not inherit.
> 
> That's what I did at first. Then I realized that I needed all functionalities 
> of Net::LDAP that I didn't reimplement, and I thus had to proxy every unknown 
> method back to Net::LDAP. That called for my module to be a subclass rather 
> than a "composition".

I dont think that means it should be a sub-class. You need to use delegation
for those methods. See http://search.cpan.org/perldoc?Class::Delegation

Graham.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About