You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Yann Ramin <at...@atrustrivalie.eu.org> on 2000/06/23 20:54:43 UTC

Caching Net::LDAP connections

Hi,

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?  Net::LDAP is not something I
would consider "blazingly fast," and opening a new LDAP connection and
binding on a pageload is a slow process.  Any advice?

Yann
-- 

--------------------------------------------------------------------
Yann Ramin			atrus@atrustrivalie.eu.org
Atrus Trivalie Productions	www.redshift.com/~yramin
Monterey High IT		www.montereyhigh.com
ICQ 				46805627
AIM				oddatrus
Marina, CA

IRM Developer                   Network Toaster Developer
SNTS Developer                  * Developer

"All cats die.  Socrates is dead.  Therefore Socrates is a cat."
	- The Logician
--------------------------------------------------------------------

Re: Caching Net::LDAP connections

Posted by Perrin Harkins <pe...@primenet.com>.
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


Re: Caching Net::LDAP connections

Posted by Rob Tanner <rt...@onlinemac.com>.
Slightly off topic, but the subject line reminds me.  I tried building 
Net::LDAP and perLDAP using Perl 5.6 and neither would build.  The compile 
could not resolve sv_undef and one other variable that slips my mind at the 
moment.  I downgraded to Perl 5.004_05 and everything build honky-dory. 
Perl 5.6 otherwise has been trouble-free and is my production tool.

Are there some known problems with 5.6 that would cause Net::LDAP and 
perLDAP not to build properly, or might this be some wierd configuration 
issue on my machine that just hasn't affected anything else.  In case it's 
germaine to the question, the host is Caldera Linux 2.3, the kernel is 
2.2.10 (yes, I need to upgrade to a .16 kernel -- it's on my list... 
really!)

-- Rob

--On Friday, June 23, 2000 11:54 AM -0700 Yann Ramin 
<at...@atrustrivalie.eu.org> wrote:

> Hi,
>
> 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?  Net::LDAP is not something I
> would consider "blazingly fast," and opening a new LDAP connection and
> binding on a pageload is a slow process.  Any advice?
>
> Yann
> --
>
> --------------------------------------------------------------------
> Yann Ramin			atrus@atrustrivalie.eu.org
> Atrus Trivalie Productions	www.redshift.com/~yramin
> Monterey High IT		www.montereyhigh.com
> ICQ 				46805627
> AIM				oddatrus
> Marina, CA
>
> IRM Developer                   Network Toaster Developer
> SNTS Developer                  * Developer
>
> "All cats die.  Socrates is dead.  Therefore Socrates is a cat."
>	 - The Logician
> --------------------------------------------------------------------




       _ _ _ _           _    _ _ _ _ _
      /\_\_\_\_\        /\_\ /\_\_\_\_\_\
     /\/_/_/_/_/       /\/_/ \/_/_/_/_/_/  QUIDQUID LATINE DICTUM SIT,
    /\/_/__\/_/ __    /\/_/    /\/_/          PROFUNDUM VIDITUR
   /\/_/_/_/_/ /\_\  /\/_/    /\/_/
  /\/_/ \/_/  /\/_/_/\/_/    /\/_/         (Whatever is said in Latin
  \/_/  \/_/  \/_/_/_/_/     \/_/              appears profound)

  Rob Tanner
  McMinnville, Oregon
  rtanner@onlinemac.com