From: Graham B. <gb...@po...> - 2000-10-10 11:59:59
|
On Tue, Oct 10, 2000 at 12:08:03PM +0100, John Berthels wrote: > > > Yes. What I have been working on is a way to easily sub-class ::Search etc. > > > > The problem is that they are created from within Net::LDAP itself, so > > somehow we need to tell Net::LDAP to create different objects. > > Taking a very quick peek, isn't this vectored through Net::LDAP::message > already? Could the subclass override this method? > > I guess it could get a little hairy, though. Um, yes. I was writing that forgetting that I have already introduced ->message. But it does not solve the problem. What if a sub-class has more than one type of search, and wants to use two different subclasses of ::Search to implement them. I think adding a class option to the methods in Net::LDAP could help solve this. In fact I think it is probably a better approach all around. Those who simply want to subclass would do sub search { shift->SUPER::search(@_,class => 'My::Search') } instead of sub message { my $ldap = shift; my $type = shift; $type = 'My::Search' if $class eq 'Net::LDAP::Search'; $type->new($ldap, @_); } Which really does require a bit too much knowledge of the Net::LDAP internals. Graham. |