On 16 Dec 2003, at 19:42, Chris Ridd wrote:


On 16/12/03 7:25 pm, Graham Barr <[EMAIL PROTECTED]> wrote:
It came up recently. My suggestion is that the user should be able to
register a callback with Net::LDAP that Net::LDAP will call when it
needs a connection to a different server. It would pass the URL details
from the referral and expect a Net::LDAP object back, which it would
then send the request to.

What problem does that solve though? The calling script still has to manage
connections (reusing where possible), still has to figure out how to connect
and bind, still has to check for referral loops, and still has to figure out
when to close any opened connections.

Yes, but it moves the need to check for that situation in the result from every call.


net::LDAP is never going to create connections for you, as it can never know 100% how to. It can know when it needs a connection, but it should be p to the application code to create it when needed.

Checking for referral loops could be done before calling your callback, but
the rest of it still seems as "messy" as the existing API.

No, because lots of stuff is hidden. Consider what you have todo today


  $mesg = $ldap->delete(@args);
  handle_referal($mesg) if (... check for referral ..);

vs

$ldap = Net::LDAP-.new(..., referral_connect => \&my_connect)

$mesg= $ldap->delete(@args);

Where referrals are done behind the scenes using &my_connect to create the connection

Graham.



Reply via email to