Config::ValidatorSchema based configuration validation | |
Download |
Config::Validator Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Lionel Cons
- Publisher web site:
- http://search.cpan.org/~lcons/
Config::Validator Tags
Config::Validator Description
Config::Validator is a Perl module that allows to perform schema based configuration validation.The idea is to define in a schema what a valid data is. This schema can be used to create a validator object that can in turn be used to make sure that some data indeed conforms to the schema.Although the primary focus is on "configuration" (for instance as provided by modules like Config::General) and, to a lesser extent, "options" (for instance as provided by modules like Getopt::Long), this module can in fact validate any data structure.SYNOPSIS use Config::Validator; # simple usage $validator = Config::Validator->new({ type => "list(integer)" }); $validator->validate(); # OK $validator->validate(); # FAIL $validator->validate({ 1, 2 }); # FAIL # advanced usage $validator = Config::Validator->new( octet => { type => "integer", min => 0, max => 255, }, color => { type => "struct", fields => { red => { type => "valid(octet)" }, green => { type => "valid(octet)" }, blue => { type => "valid(octet)" }, }, }, ); $validator->validate( { red => 23, green => 47, blue => 6 }, "color"); # OK $validator->validate( { red => 23, green => 470, blue => 6 }, "color"); # FAIL $validator->validate( { red => 23, green => 47, lbue => 6 }, "color"); # FAILProduct's homepage
Config::Validator Related Software