On Feb 26, 2007, at 4:49 AM, Marc Girod wrote:
Hello Graham,
Thanks again for your reply...
On 2/23/07, Graham Barr <[EMAIL PROTECTED]> wrote:
You should never call DESTROY directly.
I hear you, but do you have a pointer for me at documentation
explaining why this is wrong, what it may lead to etc.?
Preferably to perl man pages...
[ Slightly worried about a forthcoming rtfm hit on the head ]
As it states in
http://search.cpan.org/~nwclark/perl-5.8.8/pod/perlobj.pod#Destructors__
Explicitly calling DESTROY is also possible, but is usually never
needed
But calling DESTROY explicitly is NOT destroying the object. It is
called
DESTROY because perl will call it when the object is destroyed. Not
all objects even define a DESTROY method.
Calling
$ldap->disconnect;
should be enough
The problem with that is that 'disconnect' is a function of Net::LDAP,
which is not exposed by the intermediate package I use, and thus,
following your advice leads to:
svn> ./utils/chkprop-cron
Can't locate object method "disconnect" via package "IonaLDAP" at
./utils/chkprop-cron line 199.
(in cleanup) Can't call method "FETCH" on an undefined value at
/usr/lib/perl5/site_perl/5.8.5/Net/LDAP.pm line 266 during global
destruction.
Ah, I was assuming that $ldap in your script you were calling DESTROY on
was a Net::LDAP object.
So whatever IonaLDAP is it should provide a way to disconnect from
the server.
Or at least not call unbind in its DESTROY method. It is usually not
required
anyway as the socket connection will get closed anyway.
Graham.
Is it to say I ought to modify the module?
Would you please advise me how?
I'd say it packages for me a useful bunch of clues on getting specific
info from our company ldap database...
Marc