From: Graham B. <gb...@po...> - 2000-08-17 14:31:02
|
On Thu, Aug 17, 2000 at 09:06:07AM -0500, Mark Wilcox wrote: > I'm +1 for returning Net::LDAP::Message because that's what we normally > get. Hm.. > I think anything under Net::LDAP:: that's not part of the simple API, it > should return the Message object. Well I guess this is debatable if it is part of either. I would not say it is part of the main API as it performs multiple requests and so cannot be used in async mode. (well it could if it was re-written to do everything with callback, an exercise for the reader :) And I would not say it was part of the simple API because it's not a simplified view of something the main API can do. Well it is, but it's also useful to the main API. So it is a Util. Now the question of what Util subs should return ? Graham, > Mark > > On Thu, 17 Aug 2000, John Berthels wrote: > > > On Wed, 16 Aug 2000, John Berthels wrote: > > > > > > > > > > > > You must delete all children entries first before you can delete any > > > > parent entries. > > > > > > Net::LDAP::Util::ldap_delete_tree anyone? > > > > > > This one return true/false and sets $!. I realise this is a bit odd - > > would it be better to propogate the Net::LDAP::Message back to the caller? > > > > jb > > > > > > > > sub ldap_delete_tree { > > my $ldap = shift; > > my $dn = shift; > > > > my $msg = $ldap->search( base => $dn, > > scope => 1, > > filter => "(objectclass=*)", > > attr => [ "1.1" ] > > ); > > unless( $msg->code() == LDAP_SUCCESS ) { > > $! = Net::LDAP::Util::ldap_error_text( $msg->code() ); > > return undef; > > } > > > > # > > # Recursively get rid of children, if any > > # > > foreach my $entry ( $msg->entries() ) { > > my $dn = $entry->dn(); > > return undef unless ldap_delete_tree( $ldap, $dn ); > > } > > > > # And then ourselves > > $msg = $ldap->delete( $dn ); > > unless( $msg->code() == LDAP_SUCCESS ) { > > $! = Net::LDAP::Util::ldap_error_text( $msg->code() ); > > return undef; > > } > > > > return 1; > > } > > > > > > > > > > > |