MooseX::TraitFor::Meta::TypeConstraint::Mooish3pm
Handle moo-style constraints
Usage
This trait implements the functionality described in MooseX::Meta::TypeConstraint::Mooish, and you, dear reader, are encouraged to read about it over there. Here we simply document the nuts and bolts.
Version
This document describes version 0.001 of MooseX::TraitFor::Meta::TypeConstraint::Mooish - released March 12, 2015 as part of MooseX-Meta-TypeConstraint-Mooish.
Overview
# determining where this goes is left as an exercise for the readerwith 'MooseX::TraitFor::Meta::TypeConstraint::Mooish';
Attributes
original_constraint
The original constraint CodeRef is stashed away here.
mooish
If true, the constraint should be considered written in the style of Moo constraints; that is, if an exception is thrown the constraint is considered to have failed; otherwise it passes. Return values are ignored.
Default is true.
Methods
original_constraint()
Reader for the "original_constraint" attribute; returns the original constraint as passed to new().
has_original_constraint()
Predicate for the "original_constraint" attribute.
mooish()
Reader for the "mooish" attribute.
compile_type_constraint
If "mooish" is true, we wrap the "original_constraint" in a sub that translates Moo behaviors (die on fail; otherwise success) to Moose::Meta::TypeConstraint expectations (false on fail; true on success).
We stash the original constraint in "original_constraint" (surprise!), and set the constraint attribute to the wrapped constraint.
create_child_type
Subtypes created here are not mooish, unless an explicit "mooish =" 1> is passed.
Source
The development version is on github at <http://https://github.com/RsrchBoy/moosex-meta-typeconstraint-mooish> and may be cloned from <git://https://github.com/RsrchBoy/moosex-meta-typeconstraint-mooish.git>
Copyright and license
This software is Copyright (c) 2015 by Chris Weyl.
This is free software, licensed under:
The GNU Lesser General Public License, Version 2.1, February 1999
Releases
5 releases since Debian 9 (Stretch); the text changed 2 times.