[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[patch] use of non-localised $_ in Net::LDAP::Constant causes prolems in lemonldap-ng



Hi,

[perl-ldap 0.4001; perl 5.10.1]

Please find attached a patch that fixes a problem when requiring 
Net::LDAP in certain environments. The problem can be demonstrated by 
running:

    perl -we'require Net::LDAP for (1,2)'

Similar code is used in lemonldap-ng's test suite since a long time, 
and with perl-ldap 0.4001, tests suddenly fail. There is a bug report 
in Debian about this at http://bugs.debian.org/577340

I hope the patch is OK and you would incorporate it in a future 
perl-ldap release.

Thanks.
Author: Damyan Ivanov <dmn@debian.org>
Description: localize $_ before reading over <DATA> as $_ may be aliased
 For example, this would fail: for ( 1, 2 ) { require Net::LDAP::Constant }
 This posed a problem for lemonldap-ng's test suite
Bug-Debian: 577340
--- a/lib/Net/LDAP/Constant.pm
+++ b/lib/Net/LDAP/Constant.pm
@@ -10,6 +10,7 @@ use Exporter qw(import);
 
 my @err2name;
 
+local $_;
 while(<DATA>) {
   last if /^=cut/;
   my $protocol_const = /^=head2 Protocol Constants/ ... /^=head2/;

Reply to: