Net::LDAP object inside a callback function

Téssio Fechine <[email protected]> Mon, 30 Mar 2015 15:01:11 -0300
Newsgroups gmane.comp.lang.perl.modules.ldap
Message-ID <CADoaTFM-h5EWVY7vUOtdOFtB=kqe8OFK96_X1pHT0M6-N86eLA@mail.gmail.com>
--f46d043bdde46be20f0512854469
Content-Type: text/plain; charset=UTF-8

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});
(...)

Thanks!

--f46d043bdde46be20f0512854469
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<div><br></div><div>I want to pass a callback function =
to a search command. My function, compare_attributes, uses the method compa=
re on the entry object passed as the 2th parameter. Is there a way to use t=
he method compare without making the=C2=A0Net::LDAP object a global?</div><=
div><br></div><div><div>sub compare_attributes</div><div>(...)</div><div>fo=
reach my $a (keys %ATTR) {</div><div>$mesg =3D $LDAP-&gt;compare($entry, at=
tr =3D&gt; $a, value =3D&gt; $ATTR{$a});</div></div><div>(...)</div><div><b=
r></div><div>Thanks!</div></div>

--f46d043bdde46be20f0512854469--