On Tue, Sep 27, 2005 at 12:13:57AM +0100, Chris Ridd wrote:
> On 26/9/05 11:30, Anthony M. Martinez <[EMAIL PROTECTED]> wrote:
> 
> > This brings me to my question: What's the easiest/most correct way of going
> > over all the values in a Net::LDAP::Entry and doing the global replacement?
> > The manpage scares me with it's talk of not modifying the asref=>1 objects
> > directly.
> 
> I'm not sure that's quite the right approach either, but it depends on what
> your entries contain, how they're named, and so on.

Basically, we have a bunch of attributes which may or may not contain the
username/uid. The global replace per attribute is correct for our situation.

> 
> If you've only got one value in an attribute (e.g. only one uid) then you
> don't need to know the value to change it. Just call the modify method using
> 'replace' and the new value. Bam, the old one's gone. If you're changing
> several things in the entry you'll want to do it in one modify operation for
> efficiency, probably (but not necessarily) via the modify method's 'changes'
> option.
> 
> If the uid's used to name the entry (e.g.
> "uid=xyz123,ou=Students,dc=wombat,dc=edu") then to change the uid you need
> to rename the entry instead of modifying it. LDAP's rename operation
> (Net::LDAP's moddn method) lets you automatically delete the previous
> attribute value used in the RDN.

Originally I was planning on $entry->clone, deleting the old one, and adding the
new one, but then I remembered modrdn. So now,

I am planning on modrdn, loop over the values doing the replace, and going
$entry->update;

Pi

-- 
panic ("No CPUs found.  System halted.\n");
        2.4.3 linux/arch/parisc/kernel/setup.c

Reply via email to