fix a bunch of spelling errors
[gitmo/Moose.git] / lib / Moose / Manual / Delta.pod
CommitLineData
600f7f85 1=pod
2
3=head1 NAME
4
5Moose::Manual::Delta - Important Changes in Moose
6
7=head1 DESCRIPTION
8
0f13f53c 9This documents any important or noteworthy changes in Moose, with a
10focus on backwards. This does duplicate data from the F<Changes> file,
11but aims to provide more details and when possible workarounds.
12
13Besides helping keep up with changes, you can also use this document
14for finding the lowest version of Moose that supported a given
15feature. If you encounter a problem and have a solution but don't see
16it documented here, or think we missed an important feature, please
17send us a patch.
600f7f85 18
19=head1 Version 0.73
20
0f13f53c 21Calling C<subtype> with a name as the only argument now throws an
600f7f85 22exception. If you want an anonymous subtype do:
23
24 my $subtype = subtype as 'Foo';
25
0f13f53c 26This is related to the changes in version 0.71_01.
600f7f85 27
28=head1 Version 0.72
29
0f13f53c 30A mutable class accepted C<< Foo->new(undef) >> without complaint,
31while an immutable class would blow up with an unhelpful error. Now,
32in both cases we throw a helpful error instead.
600f7f85 33
0f13f53c 34This "feature" was originally added to allow for cases such as this:
600f7f85 35
36 my $args;
0f13f53c 37
38 if ( something() ) {
39 $args = {...};
600f7f85 40 }
0f13f53c 41
600f7f85 42 return My::Class->new($args);
43
0f13f53c 44But we decided this is a bad idea and a little too magical, because it
45can easily mask real errors.
600f7f85 46
47=head1 Version 0.71_01
48
0f13f53c 49Calling C<type> or C<subtype> without the sugar helpers (C<as>,
50C<where>, C<message>) is now deprecated.
51
52As a side effect, this meant we ended up using Perl prototypes on
53C<as>, and code like this will no longer work:
600f7f85 54
55 use Moose::Util::TypeConstraints;
56 use Declare::Constraints::Simple -All;
0f13f53c 57
58 subtype 'ArrayOfInts'
600f7f85 59 => as 'ArrayRef'
60 => IsArrayRef(IsInt);
61
62Instead it must be changed to this:
63
0f13f53c 64 subtype(
65 'ArrayOfInts' => {
66 as => 'ArrayRef',
67 where => IsArrayRef(IsInt)
68 }
600f7f85 69 );
70
0f13f53c 71If you want to maintain backwards compat with older versions of Moose,
72you must explicitly test Moose's C<VERSION>:
600f7f85 73
0f13f53c 74 if ( Moose->VERSION < 0.71_01 ) {
75 subtype 'ArrayOfInts'
600f7f85 76 => as 'ArrayRef'
77 => IsArrayRef(IsInt);
78 }
79 else {
0f13f53c 80 subtype(
81 'ArrayOfInts' => {
82 as => 'ArrayRef',
83 where => IsArrayRef(IsInt)
84 }
600f7f85 85 );
86 }
87
88=head1 Version 0.70
89
0f13f53c 90We no longer pass the meta-attribute object as a final argument to
91triggers. This actually changed for inlined code a while back, but the
92non-inlined version and the docs were still out of date.
93
94If by some chance you actually used this feature, the workaround is
95simple. You fetch the attribute object from out of the C<$self>
96that is passed as the first argument to trigger, like so:
97
98 has 'foo' => (
99 is => 'ro',
100 isa => 'Any',
101 trigger => sub {
102 my ( $self, $value ) = @_;
103 my $attr = $self->meta->find_attribute_by_name('foo');
104
105 # ...
106 }
107 );
600f7f85 108
109=head1 Version 0.66
110
0f13f53c 111If you created a subtype and passed a parent that Moose didn't know
112about, it simply ignored the parent. Now it automatically creates the
113parent as a class type. This may not be what you want, but is less
114broken than before.
600f7f85 115
0f13f53c 116You could declare a name with subtype such as "Foo!Bar". Moose would
117accept this allowed, but if you used it in a parameterized type such
118as "ArrayRef[Foo!Bar]" it wouldn't work. We now do some vetting on
119names created via the sugar functions, so that they can only contain
120alphanumerics, ":", and ".".
600f7f85 121
122=head1 Version 0.65
123
124Methods created via an attribute can now fulfill a C<requires>
0f13f53c 125declaration for a role. Honestly we don't know why Stevan didn't make
126this work originally, he was just insane or something.
600f7f85 127
0f13f53c 128Stack traces from inlined code will now report the line and file as
129being in your class, as opposed to in Moose guts.
600f7f85 130
131=head1 Version 0.62_02
132
0f13f53c 133When a class does not provide all of a role's required methods, the
134error thrown now mentions all of the missing methods, as opposed to
135just the first missing method.
600f7f85 136
0f13f53c 137Moose will no longer inline a constructor for your class unless it
138inherits its constructor is inherited from Moose::Object, and will
139warn when it doesn't inline. If you want to force inlining anyway,
140pass C<< "replace_constructor => 1 >> to C<make_immutable>.
141
142If you want to get rid of the warning, pass C<< inline_constructor =>
1431 >>.
600f7f85 144
145=head1 Version 0.62
146
0f13f53c 147Removed the (deprecated) C<make_immutable> keyword.
600f7f85 148
149Removing an attribute from a class now also removes delegation
0f13f53c 150(C<handles>) methods installed for that attribute. This is correct
600f7f85 151behavior, but if you were wrongly relying on it you might get bit.
152
153=head1 Version 0.58
154
0f13f53c 155Roles now add methods by calling C<add_method>, not
156C<alias_method>. They make sure to always provide a method object,
157which will be cloned internally. This means that it is now possible to
158track the source of a method provided by a role, and even follow its
159history through intermediate roles. This means that methods added by
160a role now show up when looking at a class's method list/map.
161
162Parameter and Union args are now sorted, this makes Int|Str the same
163constraint as Str|Int. Also, incoming type constraint strings are
164normalized to remove all whitespace differences. This is mostly for
165internals and should not affect outside code.
166
167L<Moose::Exporter> will no longer remove a subroutine that the
168exporting package re-exports. Moose re-exports the Carp::confess
169function, among others. The reasoning is that we cannot know whether
170you have also explicitly imported those functions for your own use, so
171we err on the safe side and always keep them.
600f7f85 172
173=head1 Version 0.56
174
0f13f53c 175C<Moose::init_meta> should now be called as a method.
600f7f85 176
0f13f53c 177New modules for extension writers, L<Moose::Exporter> and
178L<Moose::Util::MetaRole>.
600f7f85 179
180=head1 Version 0.55_01
181
182Implemented metaclass traits (and wrote a recipe for it):
183
184 use Moose -traits => 'Foo'
185
186This should make writing small Moose extensions a little
187easier.
188
189=head1 Version 0.55
190
191Fixed C<coerce> to accept anon types just like C<subtype> can.
192So that you can do:
193
194 coerce $some_anon_type => from 'Str' => via { ... };
195
196=head1 Version 0.51
197
52da380a 198Added C<BUILDARGS>, a new step in C<< Moose::Object->new() >>.
600f7f85 199
200=head1 Version 0.49
201
0f13f53c 202Fixed how the C<< is => (ro|rw) >> works with custom defined
203C<reader>, C<writer> and C<accessor> options. See the below table for
600f7f85 204details:
205
206 is => ro, writer => _foo # turns into (reader => foo, writer => _foo)
207 is => rw, writer => _foo # turns into (reader => foo, writer => _foo)
208 is => rw, accessor => _foo # turns into (accessor => _foo)
209 is => ro, accessor => _foo # error, accesor is rw
210
211=head1 Version 0.45
212
0f13f53c 213The C<before/around/after> method modifiers now support regexp
214matching of method names. NOTE: this only works for classes, it is
215currently not supported in roles, but, ... patches welcome.
600f7f85 216
0f13f53c 217The C<has> keyword for roles now accepts the same array ref form that
218L<Moose>.pm does for classes.
600f7f85 219
0f13f53c 220A trigger on a read-only attribute is no longer an error, as it's
221useful to trigger off of the constructor.
600f7f85 222
0f13f53c 223Subtypes of parameterizable types now are parameterizable types
224themselves.
600f7f85 225
226=head1 Version 0.44
227
0f13f53c 228Fixed issue where C<DEMOLISHALL> was eating the value in C<$@>, and so
229not working correctly. It still kind of eats them, but so does vanilla
230perl.
600f7f85 231
232=head1 Version 0.41
233
0f13f53c 234Inherited attributes may now be extended without restriction on the
600f7f85 235type ('isa', 'does').
236
0f13f53c 237The entire set of Moose::Meta::TypeConstraint::* classes were
238refactored in this release. If you were relying on their internals you
239should test your code carefully.
600f7f85 240
241=head1 Version 0.40
242
0f13f53c 243Documenting the use of '+name' with attributes that come from recently
244composed roles. It makes sense, people are using it, and so why not
245just officially support it.
600f7f85 246
0f13f53c 247The C<< Moose::Meta::Class->create >> method now supports roles.
600f7f85 248
86b96832 249It is now possible to make anonymous enum types by passing C<enum> an
250array reference instead of the C<< enum $name => @values >>.
600f7f85 251
252=head1 Version 0.37
253
0f13f53c 254Added the C<make_immutable> keyword as a shortcut to calling
255C<make_immutable> on the meta object. This eventually got removed!
600f7f85 256
0f13f53c 257Made C<< init_arg => undef >> work in Moose. This means "do not accept
600f7f85 258a constructor parameter for this attribute".
259
0f13f53c 260Type errors now use the provided message. Prior to this release they
261didn't.
600f7f85 262
263=head1 Version 0.34
264
265Moose is now a postmodern object system :)
266
0f13f53c 267The Role system was completely refactored. It is 100% backwards
268compat, but the internals were totally changed. If you relied on the
269internals then you are advised to test carefully.
600f7f85 270
271Added method exclusion and aliasing for Roles in this release.
272
0f13f53c 273Added the L<Moose::Util::TypeConstraints::OptimizedConstraints>
274module.
600f7f85 275
0f13f53c 276Passing a list of values to an accessor (which is only expecting one
277value) used to be silently ignored, now it throws an error.
600f7f85 278
279=head1 Version 0.26
280
0f13f53c 281Added parameterized types and did a pretty heavy refactoring of the
282type constraint system.
600f7f85 283
0f13f53c 284Better framework extendability and better support for "making your own
285Moose".
600f7f85 286
287=head1 Version 0.25 or before
288
0f13f53c 289Honestly, you shouldn't be using versions of Moose that are this old,
290so many bug fixes and speed improvements have been made you would be
291crazy to not upgrade.
600f7f85 292
0f13f53c 293Also, I am tired of going through the Changelog so I am stopping here,
294if anyone would like to continue this please feel free.
600f7f85 295
296=head1 AUTHOR
297
298Stevan Little E<lt>stevan@iinteractive.comE<gt>
299
300=head1 COPYRIGHT AND LICENSE
301
302Copyright 2009 by Infinity Interactive, Inc.
303
304L<http://www.iinteractive.com>
305
306This library is free software; you can redistribute it and/or modify
307it under the same terms as Perl itself.
308
0f13f53c 309=cut