> On 30 Mar 2015, at 19:01, Téssio Fechine <tess...@gmail.com> wrote:
> 
> Hi,
> 
> I want to pass a callback function to a search command. My function, 
> compare_attributes, uses the method compare on the entry object passed as the 
> 2th parameter. Is there a way to use the method compare without making the 
> Net::LDAP object a global?
> 
> sub compare_attributes
> (...)
> foreach my $a (keys %ATTR) {
> $mesg = $LDAP->compare($entry, attr => $a, value => $ATTR{$a});
> (...)

I haven't looked in the debugger yet to verify, but I think you can call 
->parent on the first argument passed to the callback to get the Net::LDAP 
object.

This is only based on looking at 'sub entry' and 'sub decode' in Search.pm - 
the latter shows how the callback is called, and the former shows us using 
->parent.

HTH!

Chris

Reply via email to