Subject: | CPANPLUS::Backend methods are not $_ safe. |
Date: | Thu, 21 Aug 2008 15:50:09 +0100 |
To: | bug-CPANPLUS [...] rt.cpan.org |
From: | Charles Jardine <cj10 [...] cam.ac.uk> |
Versions:
This is perl, v5.10.0 built for x86_64-linux-thread-multi
CPANPLUS as shipped with perl (i.e. version 0.84)
The following program:
#!/usr/local/bin/perl
use CPANPLUS::Backend;
$cb = CPANPLUS::Backend->new;
$cb->fetch(modules=>[$_]) for "CPANPLUS";
dies with
Modification of a read-only value attempted at /usr/local/perl/5.10.0-A/lib/5.10.0/CPANPLUS/Module/Checksums.pm line 163.
The root cause of this is an ancient, documented, infelicity in perl.
The construct 'while (<$fh>) { ... }' uses $_, but does not localize it.
This means that any subroutine using this construct has a duty to
localize $_ to protect its caller's copy.
There is at least one more version of this bug, at CPANPLUS/Dist/MM.pm line 439.
I am impressed with CPAN++. Thank you.
I regret that I don't have the time to search for all occurrences of
'while (<...>)' and prepare a patch.
--
Charles Jardine - Computing Service, University of Cambridge
cj10@cam.ac.uk Tel: +44 1223 334506, Fax: +44 1223 334679