Hi,

On Tuesday 08 March 2005 22:53, Korsani wrote:
> It is not blocking, but rather anoying.
> Try the script and you'll see:
> Attempt to use reference as lvalue in substr at
> /usr/share/perl5/Net/LDAP/LDIF.pm line 348 [or 346, I don't remember]
>
> It is due that at this line $_[0] could be something like 'do bless
> ...'. Code, in other words. That means that if you try to 'print
> $_[0]' you won't see the code, bu substr while complain.

I tested the program and was able to reproduce the error,
but I am not sure whether I should consider this an error in Net::LDAP::LDIF.

The cause of the trouble is that the construct
 "cn=$cn,$base"
with $cn being a Unicode::String object is still a Unicode::String object.

This object gets fed into Net::LDAP::Entry and, when written using
Net::LDAP::LDIF,  leads to the undesired warning.

As a workaround I suggest changing the line
 $entry->dn( "cn=$cn,$base" );
to
 $entry->dn( 'cn='."$cn".",$base" );
This change makes the argument to $entry->dn() a string instead of a 
Unicode::String object and avoids the problem.

What do other people on the list think about it ?
Is it a bug in Net::LDAP::LDIF ?
Is the bug in Net::LDAP::Entry for not properly checking its input ?
Or is it even a bug in Unicode::String [incomplete implementation of 
substr()] ?

CU
PEter

-- 
Peter Marschall
eMail: [EMAIL PROTECTED]

Reply via email to