From: John B. <joh...@ne...> - 2000-08-17 15:57:18
|
> > This one return true/false and sets $!. I realise this is a bit odd - > > You cannot set $!, Reading $! always reads errno from C. Setting $@ would > be better. Gack. I should have read the complete perlvar entry. Apparently you can set it but only numeric values, which would then get represented as the relevent errno strings. Not useful, $@ it is. > > would it be better to propogate the Net::LDAP::Message back to the caller? > > How would you do that ? Return the message on error and undef otherwise ? I guess you could (gack. 'undef' return means success). Or construct a new ::Message object with a success code? Or stay with what we have here? > Also I would rather avoid recursion if possible, I hate recursion. Fair enough. Its your module. I've got as far as putting the opening brace of a sub on the same line as the name, so I'm gradually getting in sync with your style :-) I'm not sure I'll easily do the ->save/load as non-recursive though. [snip nice non-recursive tree_delete] Nice - except this bit: > my $msg = $ldap->search( base => $dn[0], > scope => 1, > filter => "(objectclass=*)", > attr => [ "1.1" ] > ); > > unless( $msg->code() == LDAP_SUCCESS ) { > $@ = Net::LDAP::Util::ldap_error_text( $msg->code() ); > return undef; > } > > unshift @dn, $msg->entries; needs > unshift @dn, map { $_->dn() } $msg->entries; Or perhaps you mean: unshift @dn, $ldap->list( $dn ); instead :-) regards, jb |