NAME
Data::Schema::Plugin::LoadSchema::YAMLFile - Plugin to load schemas from YAML files
SYNOPSIS
# in schemadir/even_int.yaml
- int
- divisible_by: 2
# in your code
use Data::Schema;
my $ds = Data::Schema->new;
$ds->register_plugin('Data::Schema::Plugin::LoadSchema::YAMLFile');
$ds->config->{'schema_search_path'} = ["schemadir"];
my $res;
$res = $ds->validate(2, 'even_int'); # success
$res = $ds->validate(3, 'even_int'); # fails
METHODS
get_schema($self, $name)
Return schema loaded from YAML file, or undef
if not found. List of directories to search for is specified in validator's schema_search_path
config variable. "$name", "$name.{yaml,yml}" files will be searched for.
AUTHOR
Steven Haryanto, <steven at masterweb.net>
COPYRIGHT & LICENSE
Copyright 2009 Steven Haryanto, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.