ThaiSchema - Lightweight schema validator
use ThaiSchema; match_schema({x => 3}, {x => type_int});
ThaiSchema is a lightweight schema validator.
type_int()
Is it a int value?
type_str()
Is it a str value?
type_maybe($child)
Is it maybe a $child value?
type_hash(\%schema)
type_hash( { x => type_str, y => type_int, } );
Is it a hash contains valid keys?
type_array()
type_array( type_hash({ x => type_str, y => type_int, }) );
type_bool()
Is it a boolean value?
This function allows only JSON::true, JSON::false, \1, and \0.
\1
\0
You can check a type more strictly.
This option is useful for checking JSON types.
You can allow extra key in hashref.
Tokuhiro Matsuno <tokuhirom@gmail.com>
Copyright (C) Tokuhiro Matsuno
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install ThaiSchema, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ThaiSchema
CPAN shell
perl -MCPAN -e shell install ThaiSchema
For more information on module installation, please visit the detailed CPAN module installation guide.