MooseX::Meta::TypeConstraint::Mooish3pm
Translate moo-style constraints to moose-style
Usage
# easiest is via AttributeShortcutsuse MooseX::AttributeShortcuts 0.028;has foo => (is => 'rw',isa => sub { die unless $_[0] == 5 },);# or, the hard wayuse MooseX::Meta::TypeConstraint::Mooish;has foo => (is => 'rw',isa => MooseX::Meta::TypeConstraint::Mooish->new(constraint => sub { die unless $_[0] == 5 },),);
Version
This document describes version 0.001 of MooseX::Meta::TypeConstraint::Mooish - released March 12, 2015 as part of MooseX-Meta-TypeConstraint-Mooish.
Overview
Moose type constraints are expected to return true if the value passes the constraint, and false otherwise; Moo "constraints", on the other hand, die if validation fails.
This metaclass allows for Moo-style constraints; it will wrap them and translate their Moo into a dialect Moose understands.
Note that this is largely to enable functionality in MooseX::AttributeShortcuts; the easiest way use this metaclass is by using that package. Also, as it's not inconceivable that this functionality may be desired in other constraint metaclasses, the bulk of this metaclass' functionality is implemented as a trait.
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.