Subject: | Need ability to run LDAP over an already established socket |
This is actually a patch against 0.29, but 0.32 looks the same.
I need to be able to create a socket on my own and then pass that to Net::LDAP->new. The attached patch changes the behavior of new so that if $host is a reference, but not an ARRAY reference, $host is used as the socket directly.
--- LDAP.pm.orig Wed Jun 18 14:16:08 2003
+++ LDAP.pm Wed Jul 7 19:31:54 2004
@@ -101,6 +101,8 @@
my $arg = &_options;
my $obj = bless {}, $type;
+ if ((!ref($host)) || (ref($host) eq 'ARRAY'))
+ {
foreach my $uri (ref($host) ? @$host : ($host)) {
my $scheme = $arg->{scheme} || 'ldap';
(my $h = $uri) =~ s,^(\w+)://,, and $scheme = $1;
@@ -112,6 +114,11 @@
last;
}
}
+ }
+ else
+ {
+ $obj->{net_ldap_socket} = $host;
+ }
return undef unless $obj->{net_ldap_socket};
--- LDAP.pod.orig Tue Jun 24 06:14:15 2003
+++ LDAP.pod Wed Jul 7 19:50:35 2004
@@ -78,6 +78,9 @@
made. Only when all have failed will the result of C<undef> be
returned.
+If C<HOST> is a reference to an IO::Socket object, that connection is
+used, and no new connection is established.
+
=over 4
=item port =E<gt> N