The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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