From: Graham B. <gb...@po...> - 2002-09-11 12:43:00
|
On Mon, Sep 09, 2002 at 03:24:02PM -0400, Srini Narayanappa wrote: > Hi there, > > Can anyone show me simple example of how I can replace a multi-valued > attribute? For example, I need the attribute "projectIndfex" to have > the folowing values: > > projectIndex: 1246 > projectIndex: 9654 > projectIndex: 88 > > My code below adds only the last value in the array: That is because you are telling the server to replace the projectIndex attribute with a single value 1246, then replace the projectIndex attribute with a single value 9654, then replace the projectIndex attribute with a single value 88. So you end up with just the single value 88. What you want is @modattrs = ( 'projectIndex', [ "1246", "9654", "88" ]); Also as you are only doing a single change, ordering is not important, so you don't need to specify changes =>, but can give replace => directly. my $result = $ldap->modify( $query->param("dn"), replace => \@modattrs, ); Graham. > > ----------------------------------------- > > @modattrs = ( 'projectIndex', "1246", > 'projectIndex', "9654", > 'projectIndex', "88" > ); > > my $result = $ldap->modify( $query->param("dn"), > changes => [ > #replace => [ @$modattrs ] > replace => [ @modattrs ] > ] > ); > > ----------------------------------------- > > Regards, > Srini > > > _________________________________________________________________ > Join the worlds largest e-mail service with MSN Hotmail. > http://www.hotmail.com > > > > ------------------------------------------------------- > This sf.net email is sponsored by: OSDN - Tired of that same old > cell phone? Get a new here for FREE! > https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 |