Subject: | Bug in CPAN::Mini::Inject::Config::parse_config() : trailing whitespaces in config file lines not cut |
Date: | Mon, 22 Jul 2013 14:10:10 +0200 |
To: | bug-cpan-mini-inject [...] rt.cpan.org |
From: | Wolfgang Pecho <pecho [...] belwue.de> |
Hi there !
Found a minor bug in CPAN::MIni::Inject 0.32.
In CPAN::Mini::Inject::Config::parse_config() parsing config lines is
done in
160 while ( <$fh> ) {
161 next if /^\s*#/;
162 $self->{$1} = $2 if /([^:\s]+)\s*:\s*(.*)$/;
163 delete $required{$1} if defined $required{$1};
164 }
A config line like : 'local: test_cpan ' results in
$1: 'local'
$2: 'test_cpan '
which gives a path to a local cpan directory with trainling white spaces.
The trailing white spaces should be removed.
Solution:
Replace regex
/([^:\s]+)\s*:\s*(.*)$/
by
/([^:\s]+)\s*:\s*(.*?)\s*$/
or cut off the trailing whitespaces in $2 before assigning it.
Thanks in advance
Wolfgang