Can't locate object method "disconnect" via package "Net::LDAP"

------_=_NextPart_001_01C85279.EDDDD442
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

Hello,
	I am trying to disconnect the ldap connection handle in a perl
program. Here is the sequence that I am following:
connect and bind
unbind
$ldap->disconnect();

I get the error Can't locate object method "disconnect" via package
"Net::LDAP"

How should I use disconnect?=20

What is the difference between an unbind and disconnect? Unbind seems to
work just fine. I am just curious.

Thanks,

Praveen


------_=_NextPart_001_01C85279.EDDDD442--
0
praveen
1/9/2008 4:41:40 AM
perl.ldap 1268 articles. 0 followers. Follow

8 Replies
1158 Views

Similar Articles

[PageSpeed] 48
Get it on Google Play
Get it on Apple App Store

unbind is sufficient; there is no 'disconnect', as far as I know.  See:  ht=
tp://search.cpan.org/~gbarr/perl-ldap-0.34/lib/Net/LDAP.pod

--
~Jonny Sweeny, GSEC, GCWN, GCIH, SSP-CNSA
Incident Response Manager, Lead Security Analyst
Office of the VP for Information Technology, Indiana University
PGP key & S/MIME cert: https://itso.iu.edu/Jonny_Sweeny
jsweeny@iu.edu  p(812)855-4194  f(812)856-1011

-----Original Message-----
From: Tyagi, Praveen (GE, Corporate, consultant) [mailto:praveen.tyagi@ge.c=
om]
Sent: Tuesday, January 08, 2008 23:42
To: perl-ldap@perl.org
Subject: Can't locate object method "disconnect" via package "Net::LDAP"
Importance: High

Hello,
        I am trying to disconnect the ldap connection handle in a perl
program. Here is the sequence that I am following:
connect and bind
unbind
$ldap->disconnect();

I get the error Can't locate object method "disconnect" via package
"Net::LDAP"

How should I use disconnect?

What is the difference between an unbind and disconnect? Unbind seems to
work just fine. I am just curious.

Thanks,

Praveen

0
jsweeny
1/9/2008 1:30:59 PM
On 9 Jan 2008, at 13:30, Sweeny, Jonny wrote:

> unbind is sufficient; there is no 'disconnect', as far as I know.   
> See:  http://search.cpan.org/~gbarr/perl-ldap-0.34/lib/Net/LDAP.pod

Unbind just sends the LDAP unbind operation; the connection is left  
open.

Destroying the $ldap object should close the socket. You can even call  
$ldap->socket and close that, but destroying the object is cleaner.

Cheers,

Chris
0
chrisridd
1/9/2008 7:48:06 PM
Ok. Now how do I close the connection? Is there a specific way to call
it. I don't see any information on cpa document. I might sound silly but
I am not following how to use this procedure call via perl.=20


Thanks,

Praveen
DC:*222-6758
Desk:1-518-612-6758
Cell:1-203-984-1871
Home:1-518-280-6342

-----Original Message-----
From: Chris Ridd [mailto:chrisridd@mac.com]=20
Sent: Wednesday, January 09, 2008 2:48 PM
To: Sweeny, Jonny
Cc: 'perl-ldap@perl.org'; Tyagi, Praveen (GE, Corporate, consultant)
Subject: Re: Can't locate object method "disconnect" via package
"Net::LDAP"


On 9 Jan 2008, at 13:30, Sweeny, Jonny wrote:

> unbind is sufficient; there is no 'disconnect', as far as I know.  =20
> See:  http://search.cpan.org/~gbarr/perl-ldap-0.34/lib/Net/LDAP.pod

Unbind just sends the LDAP unbind operation; the connection is left
open.

Destroying the $ldap object should close the socket. You can even call
$ldap->socket and close that, but destroying the object is cleaner.

Cheers,

Chris
0
praveen
1/9/2008 8:11:39 PM
Praveen, use these methods to destroy the object.

undef($ldap);
$ldap =3D undef;

-----Original Message-----
From: Tyagi, Praveen (GE, Corporate, consultant)
[mailto:praveen.tyagi@ge.com]=20
Sent: Wednesday, January 09, 2008 12:12 PM
To: Chris Ridd; Sweeny, Jonny
Cc: perl-ldap@perl.org
Subject: RE: Can't locate object method "disconnect" via package
"Net::LDAP"

Ok. Now how do I close the connection? Is there a specific way to call
it. I don't see any information on cpa document. I might sound silly but
I am not following how to use this procedure call via perl.=20


Thanks,

Praveen
DC:*222-6758
Desk:1-518-612-6758
Cell:1-203-984-1871
Home:1-518-280-6342

-----Original Message-----
From: Chris Ridd [mailto:chrisridd@mac.com]=20
Sent: Wednesday, January 09, 2008 2:48 PM
To: Sweeny, Jonny
Cc: 'perl-ldap@perl.org'; Tyagi, Praveen (GE, Corporate, consultant)
Subject: Re: Can't locate object method "disconnect" via package
"Net::LDAP"


On 9 Jan 2008, at 13:30, Sweeny, Jonny wrote:

> unbind is sufficient; there is no 'disconnect', as far as I know.  =20
> See:  http://search.cpan.org/~gbarr/perl-ldap-0.34/lib/Net/LDAP.pod

Unbind just sends the LDAP unbind operation; the connection is left
open.

Destroying the $ldap object should close the socket. You can even call
$ldap->socket and close that, but destroying the object is cleaner.

Cheers,

Chris
0
donm
1/9/2008 10:45:26 PM
On 9 Jan 2008, at 22:45, Don C. Miller wrote:

> Praveen, use these methods to destroy the object.
>
> undef($ldap);
> $ldap = undef;

Yep, alternatively letting the variable go out of scope (i.e. the { }  
you defined the variable in) should also work.

Cheers,

Chris
0
chrisridd
1/10/2008 7:28:00 AM
Thanks guys.=20


Thanks,

Praveen
DC:*222-6758
Desk:1-518-612-6758
Cell:1-203-984-1871
Home:1-518-280-6342

-----Original Message-----
From: Chris Ridd [mailto:chrisridd@mac.com]=20
Sent: Thursday, January 10, 2008 2:28 AM
To: Don C. Miller
Cc: Tyagi, Praveen (GE, Corporate, consultant); Sweeny, Jonny;
perl-ldap@perl.org
Subject: Re: Can't locate object method "disconnect" via package
"Net::LDAP"


On 9 Jan 2008, at 22:45, Don C. Miller wrote:

> Praveen, use these methods to destroy the object.
>
> undef($ldap);
> $ldap =3D undef;

Yep, alternatively letting the variable go out of scope (i.e. the { }
you defined the variable in) should also work.

Cheers,

Chris
0
praveen
1/10/2008 7:29:48 AM
On Wed, January 9, 2008 7:30 am, Sweeny, Jonny wrote:
> unbind is sufficient; there is no 'disconnect', as far as I know.  See:
> http://search.cpan.org/~gbarr/perl-ldap-0.34/lib/Net/LDAP.pod

Yes there is, See that very same file

http://search.cpan.org/~gbarr/perl-ldap-0.34/lib/Net/LDAP.pod#disconnect

It was added around version 0.28

> $ldap->disconnect();
>
> I get the error Can't locate object method "disconnect" via package
> "Net::LDAP"
>
> How should I use disconnect?

Exactly as you show.

> What is the difference between an unbind and disconnect? Unbind seems to
> work just fine. I am just curious.

unbind leaves your client connected to the server so you could bind()
again as a different user. ->disconnect will close the socket to the
server.

Graham.


0
gbarr
1/10/2008 2:22:16 PM
Thank you Graham. I guess I will need to upgrade to a newer version.=20


Thanks,

Praveen
DC:*222-6758
Desk:1-518-612-6758
Cell:1-203-984-1871
Home:1-518-280-6342

-----Original Message-----
From: Graham Barr [mailto:gbarr@pobox.com]=20
Sent: Thursday, January 10, 2008 9:22 AM
To: Sweeny, Jonny
Cc: 'perl-ldap@perl.org'; Tyagi, Praveen (GE, Corporate, consultant)
Subject: RE: Can't locate object method "disconnect" via package
"Net::LDAP"

On Wed, January 9, 2008 7:30 am, Sweeny, Jonny wrote:
> unbind is sufficient; there is no 'disconnect', as far as I know.
See:
> http://search.cpan.org/~gbarr/perl-ldap-0.34/lib/Net/LDAP.pod

Yes there is, See that very same file

http://search.cpan.org/~gbarr/perl-ldap-0.34/lib/Net/LDAP.pod#disconnect

It was added around version 0.28

> $ldap->disconnect();
>
> I get the error Can't locate object method "disconnect" via package=20
> "Net::LDAP"
>
> How should I use disconnect?

Exactly as you show.

> What is the difference between an unbind and disconnect? Unbind seems=20
> to work just fine. I am just curious.

unbind leaves your client connected to the server so you could bind()
again as a different user. ->disconnect will close the socket to the
server.

Graham.


0
praveen
1/10/2008 4:27:30 PM
Reply: