On Fri, 23 Jun 2000, Yann Ramin wrote:

> I've been using Net::LDAP in a mod_perl/Apache server for awhile and I
> have a question.  What would I need to do to cache the Net::LDAP
> handler/connection, like Apache::DBI?

You could start with something like this:

use vars qw($ldap);
$ldap ||= Net::LDAP->new('ldap.bigfoot.com');

Eventually you might want to make a separate subroutine (or maybe a
singleton class) that grabs the cached connection from a global, pings it
to see if it's still good, and replaces it if it fails to ping before
handing it back to the caller.

- Perrin

Reply via email to