Subject: | Perl crashes with Broken Pipe error when using escape method |
Dist name and version: Net-LDAP-FilterBuilder-1.0002
Perl Version: v5.8.4 (sun4-solaris-64int)
OS Vendor/version: Ubuntu Server 64-bit
I needed to search for a CN surrounded by wildcard characters, so the
following code was used:
my $cn = 'Joseph (Joe) Bloggs';
my $cn_match = '*' . Net::LDAP::FilterBuilder->escape($cn) . '*';
my $searchString = Net::LDAP::FilterBuilder->new(cn => \$cn_match);
print $searchString,qq{\n};
The result being 'cn=*Joseph \(Joe\) Bloggs*'
With only a few records, this produced no problems, however in my
script, I was running through a callback routine that would run these
lines (although without the example name) around 3000 times in order to
find corresponding records in another OU. This resulted in Perl crashing
with a Broken Pipe error towards the end of the script, although
sometimes occurring much earlier.
I replaced the above lines with the following:
my $cn = 'Joseph (Joe) Bloggs';
my $searchString = Net::LDAP::FilterBuilder->new('=*', cn => $cn);
$searchString =~ s/\)$/*)/g;
Which produced the output that I needed, but the Broken Pipe errors
completely disappeared.
Any further information is available on request.