Graham, sorted out why I could not see what was going wrong. I had assumed the callback received a Net::LDAP::Entry or undefined. Doh!
However, the DESTROY is still being called and killing the error messages - so this could do with being added to the package. --- LDAP.pm~ 2012-06-20 12:02:36.000000000 +0100 +++ LDAP.pm 2012-06-20 12:03:01.000000000 +0100 @@ -902,6 +902,7 @@ if (my $msgs = delete $self->{net_ldap_mesg}) { foreach my $mesg (values %$msgs) { + next unless (defined $mesg); $mesg->set_error($err, $etxt); } } Also, the following patch is needed to fix a warning which points at a bug. --- LDAP/Intermediate/SyncInfo.pm~ 2012-01-29 09:31:37.000000000 +0000 +++ LDAP/Intermediate/SyncInfo.pm 2012-06-20 12:00:27.000000000 +0100 @@ -56,9 +56,9 @@ sub newcookie { my $self = shift; - @_ ? ($self->{asn}{newcookie}=shift) - : $self->{asn}{newcookie}; - $self->{asn}{cookie}; + return (@_ + ? ($self->{asn}{newcookie}=shift) + : $self->{asn}{newcookie}); } sub responseValue { Howard.