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