Francis,

I have read it on CPAN.  I guess I missed that part.

Thanks.

Brian 

-----Original Message-----
From: Francis Swasey [mailto:frank.swa...@uvm.edu] 
Sent: Thursday, April 25, 2013 1:09 PM
To: Brian Gaber
Cc: perl-ldap@perl.org
Subject: Re: Modify only one attribute that has multiple values of the same name

Brian,

What you really want is:

$del_msg = $ldap->modify( $dn,
        changes => [
                # delete old value
                delete => [ SFTrule => [ "$old_value" ] ],
                # add new value
                add => [ SFTrule => [ "$new_value" ] ]
        ]
);

Why do both the add and delete in a single modify?  So that it is treated as an 
atom and if EITHER fails, NEITHER happens (which is the creed -- "at the very 
least, do no harm")

This is straight out of the perl-ldap documentation, have you read it?

- Frank


On Apr 25, 2013, at 12:56 PM, Brian Gaber <brian.ga...@ssc-spc.gc.ca> wrote:

> Or should the syntax be:
> 
> $del_mesg = $ldap->modify( $dn,
>   delete => {
>      SFTrule => [
>        "$value"           # Remove only this SFTrule value
>      ],
>   }
> );
> 
> This produces a LDAP Error Code: 16 - modify/delete: SFTrule: no such 
> value
> 
> -----Original Message-----
> From: Brian Gaber [mailto:brian.ga...@ssc-spc.gc.ca]
> Sent: Thursday, April 25, 2013 12:33 PM
> To: 'Francis Swasey'
> Cc: perl-ldap@perl.org
> Subject: RE: Modify only one attribute that has multiple values of the 
> same name
> 
> Would this be the correct Net::LDAP syntax to delete the particular 
> multivalued attribute?
> 
> $del_mesg = $ldap->modify( $dn,
>   delete => {
>      member      => [
>        "SFTrule=$value"           # Remove only this member
>      ],
>   }
> );
> 
> I ask because I am getting this error:
> 
> LDAP Error Code: 21 - member: value #0 invalid per syntax
> 
> Thanks.
> 
> -----Original Message-----
> From: Francis Swasey [mailto:frank.swa...@uvm.edu]
> Sent: Thursday, April 25, 2013 12:04 PM
> To: Brian Gaber
> Cc: perl-ldap@perl.org
> Subject: Re: Modify only one attribute that has multiple values of the 
> same name
> 
> On Apr 25, 2013, at 11:57 AM, Brian Gaber <brian.ga...@ssc-spc.gc.ca> wrote:
> 
>> I have a LDAP object that contains an attribute SFTrule that can have 
>> multiple values.  How do I change just one of the SFTrule attribute values?
> 
> 
> In pure ldif:
> 
> dn: existing dn
> changetype: modify
> delete: SFTrule
> SFTrule: old value
> -
> add: SFTrule
> SFTrule: new value
> -

Reply via email to