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
.
-
$STRICT
You can check a type more strictly.
This option is useful for checking JSON types.
-
$ALLOW_EXTRA
You can allow extra key in hashref.
Tokuhiro Matsuno [email protected]
Copyright (C) Tokuhiro Matsuno
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.