Skip Menu |

This queue is for tickets about the perl-ldap CPAN distribution.

Report information
The Basics
Id: 6885
Status: rejected
Priority: 0/
Queue: perl-ldap

People
Owner: Nobody in particular
Requestors: Jefferson.Ogata [...] noaa.gov
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.32
Fixed in: (no value)



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
From: Graham Barr <gbarr [...] pobox.com>
Subject: Re: [cpan #6885] Need ability to run LDAP over an already established socket
Date: Thu, 8 Jul 2004 14:23:10 +0100
To: bug-perl-ldap [...] rt.cpan.org
RT-Send-Cc:
On 8 Jul 2004, at 00:51, Guest via RT wrote: Show quoted text
> 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.
I am not going to dispute why you want to do this, but can I ask the reason ? Also, my preferred solution would be to do if (ref($host) and UNIVERSAL::isa($host, 'IO::Socket')) { # use it } else { # existing code } Of course there needs to be a warning in the POD that the user should not read/write anything directly to the socket after passing to Net::LDAP->new Graham.