{
    "content": [
        {
            "type": "text",
            "text": "# Moose::Meta::TypeConstraint (perldoc)\n\n## NAME\n\nMoose::Meta::TypeConstraint - The Moose Type Constraint metaclass\n\n## DESCRIPTION\n\nThis class represents a single type constraint. Moose's built-in type constraints, as well as\nconstraints you define, are all stored in a Moose::Meta::TypeConstraint::Registry object as\nobjects of this class.\n\n## Sections\n\n- **NAME**\n- **VERSION**\n- **DESCRIPTION**\n- **INHERITANCE**\n- **METHODS**\n- **BUGS**\n- **AUTHORS**\n- **COPYRIGHT AND LICENSE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Moose::Meta::TypeConstraint",
        "section": "",
        "mode": "perldoc",
        "summary": "Moose::Meta::TypeConstraint - The Moose Type Constraint metaclass",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "INHERITANCE",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 115,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Moose::Meta::TypeConstraint - The Moose Type Constraint metaclass\n",
                "subsections": []
            },
            "VERSION": {
                "content": "version 2.2200\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This class represents a single type constraint. Moose's built-in type constraints, as well as\nconstraints you define, are all stored in a Moose::Meta::TypeConstraint::Registry object as\nobjects of this class.\n",
                "subsections": []
            },
            "INHERITANCE": {
                "content": "\"Moose::Meta::TypeConstraint\" is a subclass of Class::MOP::Object.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "Moose::Meta::TypeConstraint->new(%options)\nThis creates a new type constraint based on the provided %options:\n\n*   name\n\nThe constraint name. If a name is not provided, it will be set to \"ANON\".\n\n*   parent\n\nA \"Moose::Meta::TypeConstraint\" object which is the parent type for the type being created.\nThis is optional.\n\n*   constraint\n\nThis is the subroutine reference that implements the actual constraint check. This defaults\nto a subroutine which always returns true.\n\n*   message\n\nA subroutine reference which is used to generate an error message when the constraint fails.\nThis is optional.\n\n*   coercion\n\nA Moose::Meta::TypeCoercion object representing the coercions to the type. This is optional.\n\n*   inlined\n\nA subroutine which returns a string suitable for inlining this type constraint. It will be\ncalled as a method on the type constraint object, and will receive a single additional\nparameter, a variable name to be tested (usually \"$\" or \"$[0]\".\n\nThis is optional.\n\n*   inlineenvironment\n\nA hash reference of variables to close over. The keys are variables names, and the values\nare *references* to the variables.\n\n$constraint->equals($typenameorobject)\nReturns true if the supplied name or type object is the same as the current type.\n\n$constraint->issubtypeof($typenameorobject)\nReturns true if the supplied name or type object is a parent of the current type.\n\n$constraint->isatypeof($typenameorobject)\nReturns true if the given type is the same as the current type, or is a parent of the current\ntype. This is a shortcut for checking \"equals\" and \"issubtypeof\".\n\n$constraint->coerce($value)\nThis will attempt to coerce the value to the type. If the type does not have any defined\ncoercions this will throw an error.\n\nIf no coercion can produce a value matching $constraint, the original value is returned.\n\n$constraint->assertcoerce($value)\nThis method behaves just like \"coerce\", but if the result is not valid according to $constraint,\nan error is thrown.\n\n$constraint->check($value)\nReturns true if the given value passes the constraint for the type.\n\n$constraint->validate($value)\nThis is similar to \"check\". However, if the type *is valid* then the method returns an explicit\n\"undef\". If the type is not valid, we call \"$self->getmessage($value)\" internally to generate\nan error message.\n\n$constraint->assertvalid($value)\nLike \"check\" and \"validate\", this method checks whether $value is valid under the constraint. If\nit is, it will return true. If it is not, an exception will be thrown with the results of\n\"$self->getmessage($value)\".\n\n$constraint->name\nReturns the type's name, as provided to the constructor.\n\n$constraint->parent\nReturns the type's parent, as provided to the constructor, if any.\n\n$constraint->hasparent\nReturns true if the type has a parent type.\n\n$constraint->parents\nReturns all of the types parents as an list of type constraint objects.\n\n$constraint->constraint\nReturns the type's constraint, as provided to the constructor.\n\n$constraint->getmessage($value)\nThis generates a method for the given value. If the type does not have an explicit message, we\ngenerate a default message.\n\n$constraint->hasmessage\nReturns true if the type has a message.\n\n$constraint->message\nReturns the type's message as a subroutine reference.\n\n$constraint->coercion\nReturns the type's Moose::Meta::TypeCoercion object, if one exists.\n\n$constraint->hascoercion\nReturns true if the type has a coercion.\n\n$constraint->canbeinlined\nReturns true if this type constraint can be inlined. A type constraint which subtypes an\ninlinable constraint and does not add an additional constraint \"inherits\" its parent type's\ninlining.\n\n$constraint->createchildtype(%options)\nThis returns a new type constraint of the same class using the provided %options. The \"parent\"\noption will be the current type.\n\nThis method exists so that subclasses of this class can override this behavior and change how\nchild types are created.\n",
                "subsections": []
            },
            "BUGS": {
                "content": "See \"BUGS\" in Moose for details on reporting bugs.\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "*   Stevan Little <stevan@cpan.org>\n\n*   Dave Rolsky <autarch@urth.org>\n\n*   Jesse Luehrs <doy@cpan.org>\n\n*   Shawn M Moore <sartak@cpan.org>\n\n*   יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>\n\n*   Karen Etheridge <ether@cpan.org>\n\n*   Florian Ragwitz <rafl@debian.org>\n\n*   Hans Dieter Pearcey <hdp@cpan.org>\n\n*   Chris Prather <chris@prather.org>\n\n*   Matt S Trout <mstrout@cpan.org>\n",
                "subsections": []
            },
            "COPYRIGHT AND LICENSE": {
                "content": "This software is copyright (c) 2006 by Infinity Interactive, Inc.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
                "subsections": []
            }
        }
    }
}