Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to replace multiple values of an attribute

18 views
Skip to first unread message

Oliver Dörr

unread,
Apr 13, 2009, 3:41:00 PM4/13/09
to perl...@perl.org
Hi,

I spent my whole afternoon searching for a solution for replacing all
values of an attrbute by an array.

So what i got is basicly an reference $values to an array of my new
values. I could iterate through the array using
foreach my $value (@$values) {...}

The code that works is:
my $mesg1=$backendConn->modify($dn,
replace => [$attr, ["Hello",
"Test"]]
);

But i need to be more flexible and tried today a lot of variations of...
my $mesg1=$backendConn->modify($dn,
replace => [$attr, @{$values}]
);

This gave me the error...
Attribute <one of the values in my array> was not found in the schema
definition.
inside the LDAP Server

$attr is a string that contains the name of the attribut.

Could somebody help me?
Oliver

Ross Steiner

unread,
Apr 13, 2009, 4:21:45 PM4/13/09
to Oliver Dörr, perl...@perl.org
Oliver,

I think the following should work (pass a reference to an array, not an array):

my $mesg1=$backendConn->modify($dn,
replace => { $attr, $values }
);

Regards,
Ross

oli...@doerr-privat.de

unread,
Apr 13, 2009, 4:50:25 PM4/13/09
to perl...@perl.org
Hmmm,

that does also not work. $mesg1->error shows "Protocol error " and
$mesg1->code = 2

No hint, in LDAP server log

Another idea?
Oliver


Steiner, Ross schrieb:

oli...@doerr-privat.de

unread,
Apr 14, 2009, 2:55:18 PM4/14/09
to Graham Barr, perl...@perl.org
Hi Graham,

thanks for your hint. I found it. The correct syntax was

my $mesg1=$backendConn->modify($dn, replace => [$attr, $values]);

The problem was, that $values was iso-8859-1 encoded. After decoding it,
it works.

Thanks again

Oliver

Graham Barr schrieb:


>
> On Apr 13, 2009, at 3:50 PM, Oliver Dörr wrote:
>
>> Hmmm,
>>
>> that does also not work. $mesg1->error shows "Protocol error " and
>> $mesg1->code = 2
>>
>> No hint, in LDAP server log
>

> Hm, it should have worked. can you turn on debug with
> $backendConn->debug(15); just before you call ->modify so we can see
> what it being sent to the server
>
> Graham.

0 new messages