Mouse::Util::does_role() respects $thing->does() method
[gitmo/Mouse.git] / lib / Mouse / Spec.pm
1 package Mouse::Spec;
2 use strict;
3 use warnings;
4
5 our $VERSION = '0.95';
6
7 our $MouseVersion = $VERSION;
8 our $MooseVersion = '1.13';
9
10 sub MouseVersion{ $MouseVersion }
11 sub MooseVersion{ $MooseVersion }
12
13 1;
14 __END__
15
16 =head1 NAME
17
18 Mouse::Spec - To what extent Mouse is compatible with Moose
19
20 =head1 VERSION
21
22 This document describes Mouse version 0.95
23
24 =head1 SYNOPSIS
25
26     use Mouse::Spec;
27
28     printf "Mouse/%s is compatible with Moose/%s\n",
29         Mouse::Spec->MouseVersion, Mouse::Spec->MooseVersion;
30
31 =head1 DESCRIPTION
32
33 Mouse is a subset of Moose. This document describes to what extend Mouse is
34 compatible (and incompatible) with Moose.
35
36 =head2 Compatibility with Moose
37
38 =head3 Sugary APIs
39
40 The sugary APIs are highly compatible with Moose. Methods which have the
41 same name as Moose's are expected to be compatible with Moose's.
42
43 =head3 Meta object protocols
44
45 Meta object protocols are a subset of the counterpart of Moose.
46 Their methods which have the same name as Moose's are expected to be
47 compatible with Moose's. Feel free to use these methods even if they
48 are not documented.
49
50 However, there are differences between Moose's MOP and Mouse's.
51 For example, meta object protocols in Mouse have no attributes by default,
52 so C<< $metaclass->meta->make_immutable() >> will not work as you expect.
53 B<Don not make metaclasses immutable>.
54
55 =head3 Mouse::Meta::Instance
56
57 Meta instance mechanism is not implemented, so you cannot change the reftype
58 of Mouse objects in the same way as Moose.
59
60 =head3 Role exclusion
61
62 Role exclusion, C<exclude()>, is not implemented.
63
64 =head3 -metaclass in Mouse::Exporter
65
66 C<< use Mouse -metaclass => ... >> are not implemented.
67 Use C<< use Mouse -traits => ... >> instead.
68
69 =head3 Mouse::Meta::Attribute::Native
70
71 Native traits are not supported directly, but C<MouseX::NativeTraits> is
72 available on CPAN. Once you have installed it, you can use it as the same way
73 in Moose. That is, native traits are automatically loaded by Mouse.
74
75 See L<MouseX::NativeTraits> for details.
76
77 =head2 Notes about Moose::Cookbook
78
79 Many recipes in L<Moose::Cookbook> fit L<Mouse>, including:
80
81 =over 4
82
83 =item *
84
85 L<Moose::Cookbook::Basics::Recipe1> - The (always classic) B<Point> example
86
87 =item *
88
89 L<Moose::Cookbook::Basics::Recipe2> - A simple B<BankAccount> example
90
91 =item *
92
93 L<Moose::Cookbook::Basics::Recipe3> - A lazy B<BinaryTree> example
94
95 =item *
96
97 L<Moose::Cookbook::Basics::Recipe4> - Subtypes, and modeling a simple B<Company> class hierarchy
98
99 =item *
100
101 L<Moose::Cookbook::Basics::Recipe5> - More subtypes, coercion in a B<Request> class
102
103 =item *
104
105 L<Moose::Cookbook::Basics::Recipe6> - The augment/inner example
106
107 =item *
108
109 L<Moose::Cookbook::Basics::Recipe7> - Making Moose fast with immutable
110
111 =item *
112
113 L<Moose::Cookbook::Basics::Recipe8> - Builder methods and lazy_build
114
115 =item *
116
117 L<Moose::Cookbook::Basics::Recipe9> - Operator overloading, subtypes, and coercion
118
119 =item *
120
121 L<Moose::Cookbook::Basics::Recipe10> - Using BUILDARGS and BUILD to hook into object construction
122
123 =item *
124
125 L<Moose::Cookbook::Roles::Recipe1> - The Moose::Role example
126
127 =item *
128
129 L<Moose::Cookbook::Roles::Recipe2> - Advanced Role Composition - method exclusion and aliasing
130
131 =item *
132
133 L<Moose::Cookbook::Roles::Recipe3> - Applying a role to an object instance
134
135 =item *
136
137 L<Moose::Cookbook::Meta::Recipe2> - A meta-attribute, attributes with labels
138
139 =item *
140
141 L<Moose::Cookbook::Meta::Recipe3> - Labels implemented via attribute traits
142
143 =item *
144
145 L<Moose::Cookbook::Extending::Recipe3> - Providing an alternate base object class
146
147 =back
148
149 =head1 SEE ALSO
150
151 L<Mouse>
152
153 L<Moose>
154
155 L<Moose::Manual>
156
157 L<Moose::Cookbook>
158
159 =cut
160