Closed Bug 1338 Opened 26 years ago Closed 25 years ago

RFE: Add a browse() method to Conn.pm

Categories

(Directory :: PerLDAP, enhancement, P5)

All
Solaris
enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: leif, Assigned: leif)

Details

We need simple way of browsing the directory (a DN), it's one of the most commonly asked questions. Something like $entry = $conn->browse($dn, [@attrs]); where the @attribute list is optional. This will effectively do a base search on the DN, with objectclass=* as the filter.
Status: NEW → ASSIGNED
Priority: P2 → P5
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Done, Kevin, does this look ok? I added both a rename() and a copy() method to Entry.pm. -- leif ############################################################################# # Rename an attribute, return TRUE or FALSE depending on the outcome. The # first argument is the name of the old attribute (e.g. CN), and the last # argument is the new name (e.g. SN). Note that the "new" attribute can not # already exist, and the old attribute must exist. # sub rename { my ($self, $old, $new) = ($_[$[], lc $_[$[ + 1], lc $_[$[ + 2]); return 0 if $self->isAttr($new); return 0 unless $self->isAttr($old); $self->setValue($new, @{$self->{$old}}); $self->remove($old); return 1; } ############################################################################# # Copy an attribute, return TRUE or FALSE depending on the outcome. This # almost identical to the rename method, except we don't delete the source. # sub copy { my ($self, $old, $new) = ($_[$[], lc $_[$[ + 1], lc $_[$[ + 2]); return 0 if $self->isAttr($new); return 0 unless $self->isAttr($old); $self->setValue($new, @{$self->{$old}}); return 1; }
Status: RESOLVED → REOPENED
Leif, The functions look pretty good - the only change I'd make is to check the return values from the setValue and remove: $self->setValue($new, @{$self->{$old}}) || return(0); $self->remove($old) || return(0); BUT NOTE: 1) I think you closed the wrong bug - these two functions belongs to bug 5274 not 1338 2) Also I can't seem to find them in Entry.pm yet . Which branch did you check this into - I'm using devel-branch-1_3? -Kevin
Status: REOPENED → RESOLVED
Closed: 25 years ago25 years ago
Ugh, yeah the wrong bug. Fortunately, I've also added the browse method to Conn.pm already... ;-). Do another "cvs update", I just checked the code in.
You need to log in before you can comment on or make changes to this bug.