On Tue 15 Mar 2005 at 19:05:00 +0900, Dick Davies wrote:

> * Ian Macdonald <ian / caliban.org> [0346 01:46]:
> > 
> > This has now been fixed in CVS. SSL connections can now also be rebound.
> 
> Lovely, ta. Out of interest, is there a reason you need to unbind before binding?
> 
> perl-ldap explicitly unbinds for you if you bind an existing connection
> (though by the sound of it that's because you actually make a new connection anyway) -
> are there reasons you wouldn't want to to that?

It all depends on how much transparency you want.

Right now, you'll get an LDAP::Error exception and the message "already
bound." if you try to bind an already bound connection. This operates on
the historic assumption that you're accidentally trying to bind twice.

In your case, you just want to rebind, but with different credentials.
In that case, you want it to implicitly unbind and reconnect before
performing your bind.

I'm not sure whether it's better for the default reaction to be to treat
this as an error or to give you exactly what you appear to be asking
for.

Another possibility is to add a Conn#rebind method, whereby you get to
explicitly request that a connection be unbound, reconnected and bound.

What do you think of that idea?

Ian
-- 
Ian Macdonald               | Hell is empty and all the devils are here. 
System Administrator        | -- Wm. Shakespeare, "The Tempest" 
ian / caliban.org             | 
http://www.caliban.org      | 
                            |