Update of /cvsroot/perl-ldap/ldap/lib/Net
In directory usw-pr-cvs1:/tmp/cvs-serv21401/lib/Net
Modified Files:
LDAP.pm
Log Message:
Allow host passed to new to be an array ref of several to try
Index: LDAP.pm
===================================================================
RCS file: /cvsroot/perl-ldap/ldap/lib/Net/LDAP.pm,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- LDAP.pm 29 Oct 2001 17:29:15 -0000 1.28
+++ LDAP.pm 18 Feb 2002 15:58:27 -0000 1.29
@@ -22,7 +22,7 @@
LDAP_INAPPROPRIATE_AUTH
);
-$VERSION = 0.25;
+$VERSION = "0.25_01";
@ISA = qw(Net::LDAP::Extra);
$LDAP_VERSION = 2; # default LDAP protocol version
@@ -96,9 +96,15 @@
my $arg = &_options;
my $obj = bless {}, $type;
- $obj->_connect($host, $arg) or return;
+ foreach my $h (ref($host) ? @$host : ($host)) {
+ if ($obj->_connect($host, $arg)) {
+ $obj->{net_ldap_host} = $h;
+ last;
+ }
+ }
+
+ return undef unless $obj->{net_ldap_socket};
- $obj->{net_ldap_host} = $host;
$obj->{net_ldap_resp} = {};
$obj->{net_ldap_version} = $arg->{version} || $LDAP_VERSION;
$obj->{net_ldap_async} = $arg->{async} ? 1 : 0;
|