For Programmers: Free Programming Magazines  


Home > Archive > LDAP > January 2008 > Can't locate object method "disconnect" via package "Net::LDAP"









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Can't locate object method "disconnect" via package "Net::LDAP"
Tyagi, Praveen

2008-01-09, 8:26 am

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


Sweeny, Jonny

2008-01-09, 8:26 am

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

Chris Ridd

2008-01-09, 7:35 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-...ib/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
Tyagi, Praveen

2008-01-09, 7:35 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-...ib/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
Don C. Miller

2008-01-09, 7:35 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-...ib/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
Chris Ridd

2008-01-10, 4:44 am


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
Tyagi, Praveen

2008-01-10, 8:24 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
Graham Barr

2008-01-10, 7:30 pm

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-...ib/Net/LDAP.pod


Yes there is, See that very same file

http://search.cpan.org/~gbarr/perl-....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.


Tyagi, Praveen

2008-01-10, 7:30 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-...ib/Net/LDAP.pod


Yes there is, See that very same file

http://search.cpan.org/~gbarr/perl-....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.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com