---
name: "MooseX::Meta::TypeConstraint::Structured"
section: "3pm"
platform: "linux"
package: "libmoosex-types-structured-perl"
version: "0.36-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/MooseX::Meta::TypeConstraint::Structured"
---

# MooseX::Meta::TypeConstraint::Structured(3pm)

Structured type constraints

## NAME

MooseX::Meta::TypeConstraint::Structured - Structured type constraints

## VERSION

version 0.36

## DESCRIPTION

A structure is a set of Moose::Meta::TypeConstraint that are 'aggregated' in such a way as that they are all applied to an incoming list of arguments.  The idea here is that a Type Constraint could be something like, "An `"Int"` followed by an `"Int"` and then a `"Str"`" and that this could be done so with a declaration like:

```
    Tuple[Int,Int,Str]; ## Example syntax
```

So a structure is a list of type constraints (the `"Int,Int,Str"` in the above example) which are intended to function together.

## ATTRIBUTES

### type\_constraints

A list of Moose::Meta::TypeConstraint objects.

### constraint\_generator

## METHODS

### validate

Messing with validate so that we can support nicer error messages.

### generate\_constraint\_for ($type\_constraints)

Given some type constraints, use them to generate validation rules for an ref of values (to be passed at check time)

### parameterize (@type\_constraints)

Given a ref of type constraints, create a structured type.

### \_\_infer\_constraint\_generator

### compile\_type\_constraint

hook into compile\_type\_constraint so we can set the correct validation rules.

### create\_child\_type

modifier to make sure we get the constraint\_generator

### is\_a\_type\_of

### is\_subtype\_of

### equals

Override the base class behavior.

### type\_constraints\_equals

Checks to see if the internal type constraints are equal.

### get\_message

Give you a better peek into what's causing the error.  For now we stringify the incoming deep value with Devel::PartialDump and pass that on to either your custom error message or the default one.  In the future we'll try to provide a more complete stack trace of the actual offending elements

A subref or closure that contains the way we validate incoming values against a set of type constraints.

This returns a CODEREF which generates a suitable constraint generator.  Not user servicable, you'll never call this directly.

## SEE ALSO

The following modules or resources may be of interest.

Moose, Moose::Meta::TypeConstraint

## SUPPORT

Bugs may be submitted through the RT bug tracker \<https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Types-Structured\> (or bug-MooseX-Types-Structured@rt.cpan.org \<mailto:bug-MooseX-Types-Structured@rt.cpan.org\>).

There is also a mailing list available for users of this distribution, at \<http://lists.perl.org/list/moose.html\>.

There is also an irc channel available for users of this distribution, at `"#moose"` on `"irc.perl.org"` \<irc://irc.perl.org/#moose\>.

## AUTHORS

- •

  John Napiorkowski \<jjnapiork@cpan.org\>

- •

  Florian Ragwitz \<rafl@debian.org\>

- •

  XXXX XXX'XX (Yuval Kogman) \<nothingmuch@woobling.org\>

- •

  Tomas (t0m) Doran \<bobtfish@bobtfish.net\>

- •

  Robert Sedlacek \<rs@474.at\>

## COPYRIGHT AND LICENSE

This software is copyright (c) 2008 by John Napiorkowski.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
