Even though I am unfamiliar with LDAP, I see that you have not received any useful responses, so I will try to help.
Is there a schema somewhere that declares whether an attribute is single-valued or multi-valued-with-one-entry? That would be the easiest solution, but, as I said, I am unfamiliar with LDAP so that may be the "obvious answer" that turns out to be useless.
The other option is to simply try something like: (assuming $ldap->modify dies when used incorrectly)
unless (eval {$ldap->modify($dn, add => {%attrs});1}) { $ldap->modify($dn, replace => {%attrs}) }
This could get a bit messy if you are trying to update multiple attributes, some of which are multi-valued. Then you will need to wrap the above in a loop and handle each attribute separately.
In reply to Re: net::ldap ->singel valued attributes and multivalued attributes
by jcb
in thread net::ldap ->singel valued attributes and multivalued attributes
by docsnyder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |