Steven Haryanto > Data-Schema > Data::Schema::Plugin::LoadSchema::YAMLFile

Download:
Data-Schema-0.136.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.136   Source  

NAME ^

Data::Schema::Plugin::LoadSchema::YAMLFile - Plugin to load schemas from YAML files

VERSION ^

version 0.136

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 <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2009 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: