[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: "Replacing" an attribute's value with "nothing"
"Mudry, Robert (N-aerotek)" wrote:
<snip>
> $ldap->modify( $dn, changes => [ replace => [ 'attrib_a' => $value_a ],
> replace => [ 'attrib_b' => $value_b ] ] );
>
> But what if the user decides to delete the value in attrib_a? I can no
> longer use "changes". I now MUST address each attribute individually,
> because I don't know if I need to do a replace or a delete for any of the
> attributes.
>
> So, if ( $value_a eq "") { # do delete } else { # do replace }. Of course,
> with delete I need to check if it succeeded or failed, and if it failed, was
> it because the attribute ALREADY doesn't exist? Or should I just ignore the
> error code, and hope the failure wasn't because of something evil like the
> connection broke. Of course, if the connection DOES break, I'm out of luck
> anyway because without being able to use "changes" any hope of atomicity is
> completely out the window.
<snip>
I think
$ldap->modify( $dn, changes => [ delete => [ 'attrib_a' ],
replace => [ 'attrib_b' => $value_b ] ] );
should allow you to delete some attributes and replace others in a
single (atomic) operation. So I don't think atomicity is out the
window.
John