Subject: | allow Dependency Injection |
Date: | Sat, 13 Apr 2013 12:14:50 -0500 |
To: | bugs-authen-simple-ldap [...] rt.cpan.org |
From: | Caleb Cushing <xenoterracide [...] gmail.com> |
It would be nice to have the ability to Inject an exiting Net::LDAP
object into Authen::SImple::LDAP.
my $ldap = Net::LDAP->new(
host => 'ldap.company.com',
basedn => 'ou=People,dc=company,dc=net',
);
my $auth = Authen::Simple::LDAP->new( ldap => $ldap );
This would provide the following benefits.
1. Inject a mock object for testing, e.g Test::Net::LDAP::Mock
a. includes the obvious benefit of not having to have a running
ldap server to run tests
2. use one Net::LDAP instance for authentication and user loading
a. less memory/cpu consumed by reusing the object (negliible)
b. less connections to the ldap server? (I'm not sure this is true,
because I'm not sure if Net::LDAP (or ldap in general) would need to
reconnect later to get the users full information when requested
outside of Authen::Simple::LDAP
--
Caleb Cushing
http://xenoterracide.com