1MooseX::Meta::TypeConstUrsaeirntC:o:nMtoroiibsuht(e3d)PMeorolseDXo:c:uMmeetnat:a:tTiyopneConstraint::Mooish(3)
2
3
4
6 MooseX::Meta::TypeConstraint::Mooish - Translate Moo-style constraints
7 to Moose-style
8
10 This document describes version 0.001 of
11 MooseX::Meta::TypeConstraint::Mooish - released March 12, 2015 as part
12 of MooseX-Meta-TypeConstraint-Mooish.
13
15 # easiest is via AttributeShortcuts
16 use MooseX::AttributeShortcuts 0.028;
17
18 has foo => (
19 is => 'rw',
20 isa => sub { die unless $_[0] == 5 },
21 );
22
23 # or, the hard way
24 use MooseX::Meta::TypeConstraint::Mooish;
25
26 has foo => (
27 is => 'rw',
28 isa => MooseX::Meta::TypeConstraint::Mooish->new(
29 constraint => sub { die unless $_[0] == 5 },
30 ),
31 );
32
34 Moose type constraints are expected to return true if the value passes
35 the constraint, and false otherwise; Moo "constraints", on the other
36 hand, die if validation fails.
37
38 This metaclass allows for Moo-style constraints; it will wrap them and
39 translate their Moo into a dialect Moose understands.
40
41 Note that this is largely to enable functionality in
42 MooseX::AttributeShortcuts; the easiest way use this metaclass is by
43 using that package. Also, as it's not inconceivable that this
44 functionality may be desired in other constraint metaclasses, the bulk
45 of this metaclass' functionality is implemented as a trait.
46
48 Please see those modules/websites for more information related to this
49 module.
50
51 · MooseX::AttributeShortcuts
52
53 · MooseX::TraitFor::Meta::TypeConstraint::Mooish
54
56 The development version is on github at
57 <http://https://github.com/RsrchBoy/moosex-meta-typeconstraint-mooish>
58 and may be cloned from
59 <git://https://github.com/RsrchBoy/moosex-meta-typeconstraint-mooish.git>
60
62 Please report any bugs or feature requests on the bugtracker website
63 https://github.com/RsrchBoy/moosex-meta-typeconstraint-mooish/issues
64
65 When submitting a bug or request, please include a test-file or a patch
66 to an existing test-file that illustrates the bug or desired feature.
67
69 Chris Weyl <cweyl@alumni.drew.edu>
70
71 I'm a material boy in a material world
72 Please note I do not expect to be gittip'ed or flattr'ed for this work,
73 rather it is simply a very pleasant surprise. I largely create and
74 release works like this because I need them or I find it enjoyable;
75 however, don't let that stop you if you feel like it ;)
76
77 Flattr this
78 <https://flattr.com/submit/auto?user_id=RsrchBoy&url=https%3A%2F%2Fgithub.com%2FRsrchBoy%2Fmoosex-
79 meta-typeconstraint-mooish&title=RsrchBoy's%20CPAN%20MooseX-Meta-
80 TypeConstraint-Mooish&tags=%22RsrchBoy's%20MooseX-Meta-TypeConstraint-
81 Mooish%20in%20the%20CPAN%22>, gittip me
82 <https://www.gittip.com/RsrchBoy/>, or indulge my Amazon Wishlist
83 <http://bit.ly/rsrchboys-wishlist>... If you so desire.
84
86 This software is Copyright (c) 2015 by Chris Weyl.
87
88 This is free software, licensed under:
89
90 The GNU Lesser General Public License, Version 2.1, February 1999
91
92
93
94perl v5.32.0 2020-0M7o-o2s8eX::Meta::TypeConstraint::Mooish(3)