* Ian Macdonald <ian@caliban.org> [0302 23:02]:
> 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.
I think that's what feels wrong about a bind just clobbering the existing
connection, and why I hesitated to suggest it. There's a possibility that this
would mask coding errors if you accidentally try to use a connection you think
is free.
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 think I'm probably being lazy. It's just the code ends up a little cleaner
that way. Whether it's worth adding the complexity to the library just for that
is up to you...
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.
I think a rebind method would be better than bind 'magically' throwing away
the old connection. It's self-documenting in many ways, and ticks my box of
keeping it to a single method.
Thanks a lot for being so patient - my reaction in your shoes would probably
be closer to "why don't you marry perl-ldap, you love it so much?" 
···
On Tue 15 Mar 2005 at 19:05:00 +0900, Dick Davies wrote:
--
'What have you done to the cat? It looks half-dead.'
-- Schroedinger's wife
Rasputin :: Jack of All Trades - Master of Nuns