1MooX::late(3)         User Contributed Perl Documentation        MooX::late(3)
2
3
4

NAME

6       MooX::late - easily translate Moose code to Moo
7

SYNOPSIS

9          package Foo;
10          use Moo;
11          use MooX::late;
12          has bar => (is => "ro", isa => "Str", default => "MacLaren's Pub");
13
14       (Examples for Moo roles in section below.)
15

DESCRIPTION

17       Moo is a light-weight object oriented programming framework which aims
18       to be compatible with Moose. It does this by detecting when Moose has
19       been loaded, and automatically "inflating" its classes and roles to
20       full Moose classes and roles. This way, Moo classes can consume Moose
21       roles, Moose classes can extend Moo classes, and so forth.
22
23       However, the surface syntax of Moo differs somewhat from Moose. For
24       example the "isa" option when defining attributes in Moose must be
25       either a string or a blessed Moose::Meta::TypeConstraint object; but in
26       Moo must be a coderef. These differences in surface syntax make porting
27       code from Moose to Moo potentially tricky. MooX::late provides some
28       assistance by enabling a slightly more Moosey surface syntax.
29
30       MooX::late does the following:
31
32       1.  Supports "isa => $stringytype".
33
34       2.  Supports "does => $rolename" .
35
36       3.  Supports "lazy_build => 1".
37
38       4.  Exports "blessed" and "confess" functions to your namespace.
39
40       5.  Handles certain attribute traits. Currently "Hash", "Array" and
41           "Code" are supported. This feature requires MooX::HandlesVia.
42
43           "String", "Number", "Counter" and "Bool" are unlikely to ever be
44           supported because of internal implementation details of Moo. If you
45           need another attribute trait to be supported, let me know and I
46           will consider it.
47
48       Five features. It is not the aim of "MooX::late" to make every aspect
49       of Moo behave exactly identically to Moose. It's just going after the
50       low-hanging fruit. So it does five things right now, and I promise that
51       future versions will never do more than seven.
52
53       Previous releases of MooX::late added support for "coerce => 1" and
54       "default => $nonref". These features have now been added to Moo itself,
55       so MooX::late no longer has to deal with them.
56
57   Use in Moo::Roles
58       MooX::late should work in Moo::Roles, with no particular caveats.
59
60          package MyRole;
61          use Moo::Role;
62          use MooX::late;
63
64       Package::Variant can be used to build the Moo equivalent of
65       parameterized roles. MooX::late should work in roles built with
66       Package::Variant.
67
68          use Package::Variant
69             importing => [ qw( Moo::Role MooX::late ) ],
70             subs      => [ qw( has with ) ];
71
72   Type constraints
73       Type constraint strings are interpreted using Type::Parser, using the
74       type constraints defined in Types::Standard. This provides a very
75       slight superset of Moose's type constraint syntax and built-in type
76       constraints.
77
78       Any unrecognized string that looks like it might be a class name is
79       interpreted as a class type constraint.
80
81   Subclassing
82       MooX::late is designed to be reasonably easy to subclass. There are
83       comments in the source code explaining hooks for extensibility.
84

BUGS

86       Please report any bugs to
87       <http://rt.cpan.org/Dist/Display.html?Queue=MooX-late>.
88

SEE ALSO

90       "MooX::late" uses Types::Standard to check type constraints.
91
92       "MooX::late" uses MooX::HandlesVia to provide native attribute traits
93       support.
94
95       The following modules bring additional Moose functionality to Moo:
96
97       ·   MooX::Override - support override/super
98
99       ·   MooX::Augment - support augment/inner
100
101       MooX allows you to load Moo plus multiple MooX extension modules in a
102       single line.
103

AUTHOR

105       Toby Inkster <tobyink@cpan.org>.
106
108       This software is copyright (c) 2012-2014 by Toby Inkster.
109
110       This is free software; you can redistribute it and/or modify it under
111       the same terms as the Perl 5 programming language system itself.
112

DISCLAIMER OF WARRANTIES

114       THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
115       WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
116       MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
117
118
119
120perl v5.30.0                      2019-07-26                     MooX::late(3)
Impressum