Jesse Luehrs > MooseX-Validation-Doctypes-0.01 > MooseX::Meta::TypeConstraint::Doctype

Download:
MooseX-Validation-Doctypes-0.01.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.01   Source   Latest Release: MooseX-Validation-Doctypes-0.05

NAME ^

MooseX::Meta::TypeConstraint::Doctype - Moose type constraint for validating doctypes

VERSION ^

version 0.01

SYNOPSIS ^

  use MooseX::Validation::Doctypes;

  doctype 'Person' => {
      id    => 'Str',
      name  => 'Str',
      title => 'Str',
  };

  use JSON;

  my $data = decode_json('{"id": "1234-A", "name": "Bob", "title": "CIO"}');

  use Moose::Util::TypeConstraints;

  my $person = find_type_constraint('Person');
  die "Data is invalid" unless $person->check($data);

DESCRIPTION ^

This module implements the actual type constraint that is created by the doctype function in MooseX::Validation::Doctypes. It is a subclass of Moose::Meta::TypeConstraint which adds a required doctype parameter, and automatically generates a constraint and message which validate based on that doctype (as described in the MooseX::Validation::Doctypes docs).

ATTRIBUTES ^

doctype

The doctype to validate. Required.

AUTHOR ^

Jesse Luehrs <doy at cpan dot org>

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2012 by Jesse Luehrs.

This is free software, licensed under:

  The MIT (X11) License
syntax highlighting: