CC: | dllaurence [...] dslextreme.com |
Subject: | Calling Config::Auto::parse while $_ aliases a constant value throws exception. |
Reported on the uuasc@uuasc.org mailing list (Unix Users Association of
Southern California) by Dustin Laurence.
If $_ is aliased to a constant such as a string literal prior to calling
Config::Auto::parse(), an exception will be thrown complaining about
attempting to modify a readonly value.
Dustin Laurence created a snippet of sample code that will cause
Config::Auto to throw, and I pared it down further and turned it into a
proper test.
The test script that will cause an exception to be thrown is attached.
Dave
Subject: | constalias_it.pl |
#!perl
use Test::More;
use Test::Exception;
use strict;
use Config::Auto;
my $test_file = "/etc/fstab"; # A file found on any Unix/Linux machine.
SKIP: {
skip "Can't test: $test_file doesn't exist on this system."
unless -e $test_file;
for ( 'bar' ) {
lives_ok{ Config::Auto::parse($test_file) }
'Config::Auto:parse() where $_ aliases a string literal.';
}
}
done_testing();