NAME

Data::Rx - perl implementation of Rx schema system

VERSION

version 0.001

SYNOPSIS

my $rx = Data::Rx->new;

my $success = {
  type     => '//rec',
  required => {
    location => '//str',
    status   => { type => '//int', value => 201 },
  },
  optional => {
    comments => {
      type     => '//arr',
      contents => '//str',
    },
  },
};

my $schema = $rx->make_schema($success);

my $reply = $json->decode( $agent->get($http_request) );

die "invalid reply" unless $schema->check($reply);

SEE ALSO

http://rjbs.manxome.org/rx

METHODS

new

my $rx = Data::Rx->new(\%arg);

This returns a new Data::Rx object.

Valid arguments are:

prefix - optional; a hashref of prefix strings and values for type shorthand

make_schema

my $schema = $rx->make_schema($schema);

This returns a new schema checker (something with a check method) for the given Rx input.

AUTHOR

Ricardo SIGNES <rjbs@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2008 by Ricardo SIGNES.

This is free software; you can redistribute it and/or modify it under the same terms as perl itself.