On Wed, February 21, 2007 8:18 am, Marc Girod wrote: > (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. > > Also, I thought I could provide bits of the package code I use:
> sub DESTROY { > my $self = shift @_; > $self->{ldap}->unbind if ($self->{ldap}); > } That is the source of your problem. During Global destruction there is no defined order in which perl will call DESTROY on objects. Your call to unbind eventually causes a call to ->debug. Net::LDAP uses a tied HASH to avoid reference loops. What seems to have happened is that the internal object of the tied hash has already been freed, so when perl attempts to call FETCH on the internal object you get this error. The only safe way to solve this is to ensure that all your objects are destroyed before global destruction. Graham.