Uninitialized value warning triggered when -AutoTrue is used and a
variable without a value is parsed.
For example
-- 01.conf
a = 10
b = 10
--
works, but
-- 02.conf
a = 10
b
--
triggers undefined warning.
Uncaught exception from user code:
not defined at
/home/martink/perl/5.10.0/lib/site_perl/5.10.0/Config/General.pm line 1053
This is due to the fact that in _parse_value() the $value may be set to
undef and subsequently tested with _interpolate and rx matches.
# avoid "Use of uninitialized value"
if (! defined $value) {
$value = undef; # bigfix rt.cpan.org#42721 q();
}
if ($this->{InterPolateVars}) {
$value = $this->_interpolate($config, $option, $value);
}
# make true/false values to 1 or 0 (-AutoTrue)
if ($this->{AutoTrue}) {
if ($value =~ /$this->{AutoTrueFlags}->{true}/io) {
$value = 1;
}
elsif ($value =~ /$this->{AutoTrueFlags}->{false}/io) {
$value = 0;
}
}
I suggest the following fix.
if (! defined $value) {
$value = undef; # bigfix rt.cpan.org#42721 q();
} else {
... Interpolate and AutoTrue checks here
}