Subject: | "string" type lacks a check for reference |
Date: | Mon, 22 Mar 2010 20:24:54 +0100 |
To: | bug-Config-Validate [...] rt.cpan.org |
From: | David Serrano <dserrano5 [...] gmail.com> |
Config-Validate version: 0.2.6
Perl version: 5.10.1
OS: Ubuntu linux 2.6.31-20-generic SMP i686
When I run the following code:
---------------------------
use warnings;
use strict;
use 5.010;
use Data::Dumper;
use Config::General;
use Config::Validate;
my $schema = {
section => {
type => 'nested',
child => {
key => {
type => 'string',
},
},
},
};
my $cfgfile = <<'EOF';
<section>
key Foo
key Bar
</section>
EOF
my $config = Config::General->new (-String => $cfgfile);
print Dumper { $config->getall };
Config::Validate->new (schema => $schema)->validate (config => $config);
say "Still alive!";
---------------------------
I expect it to fail validation, since the value for "key" isn't a
string, but an "ARRAY" reference. However, the program runs to
completion.
The attached patch solves the problem for me.
--
David Serrano
Message body is not shown because sender requested not to inline it.