Bug in AppConfig 1.56?
Monday, March 7, 2011 5:16:35 PM
I've recently come across a weird behaviour in AppConfig that I suppose is a bug. I actually filed it as such, it's the #66451 on CPAN's RT.
Basically, I expect that the file() and args() methods should return the same thing if they are fed with the same configuration. Unfortunately, what happens is different.
For example, suppose you define three scalar variables, named alpha, beta and gamma, and suppose that when you set them you first declare an unknown variable named delta. E.g.: you have this configuration file:
delta = D alpha = A beta = B gamma = G
Depending on the value of CREATE and PEDANTIC, you'll have different results, namely:
| CREATE | PEDANTIC | alpha | beta | gamma | delta |
|---|---|---|---|---|---|
| not set | not set | A | B | G | undef |
| not set | set to 0 | A | B | G | undef |
| not set | set to 1 | undef | undef | undef | undef |
| set to ^[a-z_] | not set | A | B | G | D |
| set to ^[a-z_] | set to 0 | A | B | G | D |
| set to ^[a-z_] | set to 1 | A | B | G | D |
But if you run your script setting stuff in the same way, e.g.:
script.pl -delta D -alpha A -beta B -gamma G
results are completely different, namely:
| CREATE | PEDANTIC | alpha | beta | gamma | delta |
|---|---|---|---|---|---|
| not set | not set | undef | undef | undef | undef |
| not set | set to 0 | undef | undef | undef | undef |
| not set | set to 1 | undef | undef | undef | undef |
| set to ^[a-z_] | not set | undef | undef | undef | undef |
| set to ^[a-z_] | set to 0 | undef | undef | undef | undef |
| set to ^[a-z_] | set to 1 | undef | undef | undef | undef |
The only values that correspond in the two cases are those marked in yellow. Is this the intended behaviour? I don't know, I hope I'll have an authoritative response from the module authors.






