Hi Hugo,
On Sunday, 16. March 2008, Hugo Connery wrote:
> I am using Net::LDAP::LDIF to dump that entries received by calls
> to Net::LDAP::search and wish to disable wrapping (so that I can
> easily modify output using awk).
>
> I'm running Centos 5.1 with Perl 5.8.8. The perldoc Net::LDAP page lists
> Net::LDAP as v5.8.8 with date 2007-02-11
Unfortunately this version information does not tell the perl-ldap version
you use.
> perldoc Net::LDAP::LDIF says:
>
> wrap => 78
> Number of columns where output line wrapping shall occur.
>
> Default is 78. Setting it to 40 or lower inhibits wrapping.
>
> I have not been able to disable wrapping and have caused a crash:
This is a known bug which was fixed in perl-ldap's SVN a while ago.
The following patch to LDIF.pm should fix it:
--- LDAP/LDIF.pm 2007-07-21 17:50:42.000000000 +0200
+++ LDIF.pm 2007-12-08 19:13:38.000000000 +0100
@@ -384,8 +384,8 @@
}
sub _wrap {
- my $len=$_[1];
- return $_[0] if length($_[0]) <= $len or $len <= 0;
+ my $len=$_[1]; # needs to be >= 2 to avoid division by zero
+ return $_[0] if length($_[0]) <= $len or $len <= 40;
use integer;
my $l2 = $len-1;
my $x = (length($_[0]) - $len) / $l2;
Hope it helps
Peter
--
Peter Marschall
[EMAIL PROTECTED]