README
1NAME
2 MooX::late - easily translate Moose code to Moo
3
4SYNOPSIS
5 package Foo;
6 use Moo;
7 use MooX::late;
8 has bar => (is => "ro", isa => "Str", default => "MacLaren's Pub");
9
10 (Examples for Moo roles in section below.)
11
12DESCRIPTION
13 Moo is a light-weight object oriented programming framework which aims to
14 be compatible with Moose. It does this by detecting when Moose has been
15 loaded, and automatically "inflating" its classes and roles to full Moose
16 classes and roles. This way, Moo classes can consume Moose roles, Moose
17 classes can extend Moo classes, and so forth.
18
19 However, the surface syntax of Moo differs somewhat from Moose. For
20 example the `isa` option when defining attributes in Moose must be either
21 a string or a blessed Moose::Meta::TypeConstraint object; but in Moo must
22 be a coderef. These differences in surface syntax make porting code from
23 Moose to Moo potentially tricky. MooX::late provides some assistance by
24 enabling a slightly more Moosey surface syntax.
25
26 MooX::late does the following:
27
28 1. Supports `isa => $stringytype`.
29
30 2. Supports `does => $rolename` .
31
32 3. Supports `lazy_build => 1`.
33
34 4. Exports `blessed` and `confess` functions to your namespace.
35
36 5. Handles certain attribute traits. Currently `Hash`, `Array` and `Code`
37 are supported. This feature requires MooX::HandlesVia.
38
39 `String`, `Number`, `Counter` and `Bool` are unlikely to ever be
40 supported because of internal implementation details of Moo. If you
41 need another attribute trait to be supported, let me know and I will
42 consider it.
43
44 Five features. It is not the aim of `MooX::late` to make every aspect of
45 Moo behave exactly identically to Moose. It's just going after the
46 low-hanging fruit. So it does five things right now, and I promise that
47 future versions will never do more than seven.
48
49 Previous releases of MooX::late added support for `coerce => 1` and
50 `default => $nonref`. These features have now been added to Moo itself, so
51 MooX::late no longer has to deal with them.
52
53 Use in Moo::Roles
54 MooX::late should work in Moo::Roles, with no particular caveats.
55
56 package MyRole;
57 use Moo::Role;
58 use MooX::late;
59
60 Package::Variant can be used to build the Moo equivalent of parameterized
61 roles. MooX::late should work in roles built with Package::Variant.
62
63 use Package::Variant
64 importing => [ qw( Moo::Role MooX::late ) ],
65 subs => [ qw( has with ) ];
66
67 Type constraints
68 Type constraint strings are interpreted using Type::Parser, using the type
69 constraints defined in Types::Standard. This provides a very slight
70 superset of Moose's type constraint syntax and built-in type constraints.
71
72 Any unrecognized string that looks like it might be a class name is
73 interpreted as a class type constraint.
74
75 Subclassing
76 MooX::late is designed to be reasonably easy to subclass. There are
77 comments in the source code explaining hooks for extensibility.
78
79BUGS
80 Please report any bugs to
81 <http://rt.cpan.org/Dist/Display.html?Queue=MooX-late>.
82
83SEE ALSO
84 `MooX::late` uses Types::Standard to check type constraints.
85
86 `MooX::late` uses MooX::HandlesVia to provide native attribute traits
87 support.
88
89 The following modules bring additional Moose functionality to Moo:
90
91 * MooX::Override - support override/super
92
93 * MooX::Augment - support augment/inner
94
95 MooX allows you to load Moo plus multiple MooX extension modules in a
96 single line.
97
98AUTHOR
99 Toby Inkster <tobyink@cpan.org>.
100
101COPYRIGHT AND LICENCE
102 This software is copyright (c) 2012-2014 by Toby Inkster.
103
104 This is free software; you can redistribute it and/or modify it under the
105 same terms as the Perl 5 programming language system itself.
106
107DISCLAIMER OF WARRANTIES
108 THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
109 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
110 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
111
112