Important bug in Net::LDAP::LDIF

Working on my new workstation today, I discovered what to me is an important bug in recent versions of perl-ldap (a/k/a Net::LDAP).

The problem is with the current_lines method in, which is supposed to allow you to dump all lines of an LDIF entry to STDOUT or another filehandle. Basically the 0.18 version of that comes with perl-ldap 0.39 fails to display anything.

After some experimentation I found that the latest version that actually works is 0.16, that shipped with perl-ldap 0.33 many years ago. Interestingly, the 0.16 version of that comes with Ubuntu’s libnet-ldap-perl package does not exactly match what comes with the perl-ldap 0.33 distribution.

So I’ve filed my first bug report for my favorite perl module.

As a workaround I have compiled from the 0.33 perl-ldap distribution and copied it over what was installed there by Ubuntu’s package in /usr/share/perl5/Net/LDAP.


You have to love open source. Graham Barr, the author of perl-ldap, found the origin of this bug in a <a href=";a=commitdiff;h=cdeb93c0a2b4e7414455ddd7ffa7686585dfdca3
“>commit made almost 4 years ago.

He suggested I try adding

$self->{_current_lines} = $entry;
$self->{_next_lines} = $entry;

"just before the un-wrappingof the lines". I found that location in the latest distribution of between lines 128 and 129. After inserting the recommended code there I recompiled and copied the resulting over the existing module. Testing showed the fix worked perfectly. Per a later message from Graham this bug will be fixed in the next release.

Download fixed file from here, and copy over existing, until then.


Recently I decided to segregate modified modules out from the main perl distribution on my own systems. What I came up with is a new “Custom” category. On most systems these would live someplace like /usr/local/lib/perl5/site_perl/5.10.0/Custom. On Ubuntu it would be /usr/local/lib/perl/5.10.0/Custom. As a result it now gets invoked as:


The only thing you need to do to make this work is change the package declaration in the first line of the module to:

package Custom::Net::LDAP::LDIF