Version 0.17 of _wrap is as follows sub _wrap { my $len=$_[1]; return $_[0] if length($_[0]) <= $len; use integer; my $l2 = $len-1; my $x = (length($_[0]) - $len) / $l2; my $extra = (length($_[0]) == ($l2 * $x + $len)) ? "" : "a*"; join("\n ",unpack("a$len" . "a$l2" x $x . $extra,$_[0])); }
Unfortunately it does not behave as documented and actually throws a division by zero error if wrap is set to 1. This version corrects it as documented. Replace '40' with '2' and everything works including the most pathological case. sub _wrap { my $len=$_[1]; return $_[0] if $len <= 40; return $_[0] if length($_[0]) <= $len; use integer; my $l2 = $len-1; my $x = (length($_[0]) - $len) / $l2; my $extra = (length($_[0]) == ($l2 * $x + $len)) ? "" : "a*"; join("\n ",unpack("a$len" . "a$l2" x $x . $extra,$_[0])); } There is also a bug in Net::LDAP::process such that if process() is called against an LDAP object for which no requests are pending, it will hang trying to read from the socket. Unfortunately I can't figure out where that's happening exactly. This appears on Ubuntu Linux and AIX. -- Chris Dukes "In cynicism she's about 35" -- Terry Pratchett's "Hog Father"