changes and delta
[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
d6ce97b9 19=head1 NEXT
20
21=over 4
22
23=item Native Traits
24
25In previous versions of Moose, the Native delegations were created as
26closures. The generated code was often quite slow compared to doing the same
27thing by hand. For example, the Array's push delegation ended up doing
28something like this:
29
30 push @{ $self->$reader() }, @_;
31
32If the attribute was created without a reader, the C<$reader> sub reference
33followed a very slow code path. Even with a reader, this is still slower than
34it needs to be.
35
36Native delegations are now generated as inline code, just like other
37accessors, so we can access the slot directly.
38
39In addition, native traits now do proper constraint checking in all cases. In
40particular, constraint checking has been improved for array and hash
41references. Previously, only the I<contained> type (the C<Str> in
42C<HashRef[Str]>) would be checked when a new value was added to the
43collection. However, if there was a constraint that applied to the whole
44value, this was never checked.
45
46In addition, coercions are now called on the whole value.
47
27719606 48The delegation methods now do more argument checking. All of the methods check
49that a valid number of arguments were passed to the method. In addition, the
50delegation methods check that the arguments are sane (array indexes, hash
51keys, numbers, etc.) when applicable. We have tried to emulate the behavior of
52Perl builtins as much as possible.
53
d6ce97b9 54Finally, triggers are called whenever the value of the attribute is changed by
55a Native delegation.
56
c99ddeb7 57These changes are only likely to break code in a few cases.
58
59The inlning code may or may not preserve the original reference when changes
60are made. In some cases, methods which change the value may replace it
61entirely. This will break tied values.
62
63If you have a typed arrayref or hashref attribute where the type enforces a
64constraint on the whole collection, this constraint will now be checked. It's
65possible that code which previously ran without errors will now cause the
66constraint to fail. However, presumably this is a good thing ;)
d6ce97b9 67
27719606 68If you are passing invalid arguments to a delegation which were previously
c99ddeb7 69being ignore, these calls will now fail.
27719606 70
c99ddeb7 71If your code relied on the trigger only being called for a regular writer,
72that may cause problems.
d6ce97b9 73
74As always, you are encouraged to test before deploying the latest version of
75Moose to production.
76
a2084f68 77=item The C<meta> method
78
79Moose and Class::MOP have been cleaned up internally enough to make the
80C<meta> method that you get by default optional. C<use Moose> and
81C<use Moose::Role> now can take an additional C<-meta_name> option, which
82tells Moose what name to use when installing the C<meta> method. Passing
83C<undef> to this option suppresses generation of the C<meta> method
84entirely. This should be useful for users of modules which also use a C<meta>
85method or function, such as L<Curses> or L<Rose::DB::Object>.
86
d6ce97b9 87=back
88
aee0741b 89=head1 1.09
90
7dacb294 91=over 4
92
4c7d1018 93=item All deprecated features now warn
94
95Previously, deprecation mostly consisted of simply saying "X is deprecated" in
96the Changes file. We were not very consistent about actually warning. Now, all
97deprecated features still present in Moose actually give a warning. The
98warning is issued once per calling package. See L<Moose::Deprecated> for more
99details.
100
2b54d2a6 101=item You cannot pass C<< coerce => 1 >> unless the attribute's type constraint has a coercion
102
103Previously, this was accepted, and it sort of worked, except that if you
104attempted to set the attribute after the object was created, you would get a
105runtime error.
106
aa6da652 107Now you will get a warning when you attempt to define the attribute.
2b54d2a6 108
aee0741b 109=item C<no Moose>, C<no Moose::Role>, and C<no Moose::Exporter> no longer unimport strict and warnings
110
111This change was made in 1.05, and has now been reverted. We don't know if the
dee8c866 112user has explicitly loaded strict or warnings on their own, and unimporting
113them is just broken in that case.
aee0741b 114
59caebc4 115=item Reversed logic when defining which options can be changed
7782e1da 116
da7efd4c 117L<Moose::Meta::Attribute> now allows all options to be changed in an
118overridden attribute. The previous behaviour required each option to be
119whitelisted using the C<legal_options_for_inheritance> method. This method has
120been removed, and there is a new method, C<illegal_options_for_inheritance>,
121which can now be used to prevent certain options from being changeable.
7782e1da 122
da7efd4c 123In addition, we only throw an error if the illegal option is actually
124changed. If the superclass didn't specify this option at all when defining the
125attribute, the subclass version can still add it as an option.
dede9732 126
127Example of overriding this in an attribute trait:
7782e1da 128
dede9732 129 package Bar::Meta::Attribute;
130 use Moose::Role;
7782e1da 131
132 has 'my_illegal_option' => (
da7efd4c 133 isa => 'CodeRef',
134 is => 'rw',
7782e1da 135 );
136
137 around illegal_options_for_inheritance => sub {
da7efd4c 138 return ( shift->(@_), qw/my_illegal_option/ );
7782e1da 139 };
140
7dacb294 141=back
142
e462f6f3 143=head1 1.05
144
a19ae3d7 145=over 4
146
147=item L<Moose::Object/BUILD> methods are now called when calling C<new_object>
148
149Previously, C<BUILD> methods would only be called from C<Moose::Object::new>,
150but now they are also called when constructing an object via
151C<Moose::Meta::Class::new_object>. C<BUILD> methods are an inherent part of the
152object construction process, and this should make C<< $meta->new_object >>
153actually usable without forcing people to use C<< $meta->name->new >>.
154
2fee26f1 155=item C<no Moose>, C<no Moose::Role>, and C<no Moose::Exporter> now unimport strict and warnings
156
157In the interest of having C<no Moose> clean up everything that C<use Moose>
158does in the calling scope, C<no Moose> (as well as all other
159L<Moose::Exporter>-using modules) now unimports strict and warnings.
160
f46a74bf 161=item Metaclass compatibility checking and fixing should be much more robust
162
163The L<metaclass compatibility|Moose/METACLASS COMPATIBILITY AND MOOSE> checking
164and fixing algorithms have been completely rewritten, in both Class::MOP and
165Moose. This should resolve many confusing errors when dealing with non-Moose
166inheritance and with custom metaclasses for things like attributes,
918b5cef 167constructors, etc. For correct code, the only thing that should require a
168change is that custom error metaclasses must now inherit from
169L<Moose::Error::Default>.
f46a74bf 170
a19ae3d7 171=back
172
8ff79890 173=head1 1.02
174
175=over 4
176
177=item Moose::Meta::TypeConstraint::Class is_subtype_of behavior
178
179Earlier versions of L<is_subtype_of|Moose::Meta::TypeConstraint::Class/is_subtype_of>
180would incorrectly return true when called with itself, its own TC name or
181its class name as an argument. (i.e. $foo_tc->is_subtype_of('Foo') == 1) This
182behavior was a caused by C<isa> being checked before the class name. The old
183behavior can be accessed with L<is_type_of|Moose::Meta::TypeConstraint::Class/is_type_of>
184
185=back
186
12885414 187=head1 1.00
188
189=over 4
190
191=item Moose::Meta::Attribute::Native::Trait::Code no longer creates reader methods by default
192
193Earlier versions of L<Moose::Meta::Attribute::Native::Trait::Code> created
194read-only accessors for the attributes it's been applied to, even if you didn't
195ask for it with C<< is => 'ro' >>. This incorrect behaviour has now been fixed.
196
197=back
198
775666aa 199=head1 0.95
200
201=over 4
202
203=item Moose::Util add_method_modifier behavior
204
205add_method_modifier (and subsequently the sugar functions Moose::before,
206Moose::after, and Moose::around) can now accept arrayrefs, with the same
207behavior as lists. Types other than arrayref and regexp result in an error.
208
209=back
210
5b7b27e2 211=head1 0.93_01 and 0.94
212
213=over 4
214
f785aad8 215=item Moose::Util::MetaRole API has changed
216
217The C<apply_metaclass_roles> function is now called C<apply_metaroles>. The
218way arguments are supplied has been changed to force you to distinguish
219between metaroles applied to L<Moose::Meta::Class> (and helpers) versus
220L<Moose::Meta::Role>.
221
222The old API still works, but will warn in a future release, and eventually be
223removed.
224
225=item Moose::Meta::Role has real attributes
226
227The attributes returned by L<Moose::Meta::Role> are now instances of the
228L<Moose::Meta::Role::Attribute> class, instead of bare hash references.
229
5b7b27e2 230=item "no Moose" now removes C<blessed> and C<confess>
231
232Moose is now smart enough to know exactly what it exported, even when it
233re-exports functions from other packages. When you unimport Moose, it will
234remove these functions from your namespace unless you I<also> imported them
235directly from their respective packages.
236
237If you have a C<no Moose> in your code I<before> you call C<blessed> or
238C<confess>, your code will break. You can either move the C<no Moose> call
239later in your code, or explicitly import the relevant functions from the
240packages that provide them.
241
242=item L<Moose::Exporter> is smarter about unimporting re-exports
243
244The change above comes from a general improvement to L<Moose::Exporter>. It
245will now unimport any function it exports, even if that function is a
246re-export from another package.
247
f427b505 248=item Attributes in roles can no longer override class attributes with "+foo"
249
250Previously, this worked more or less accidentally, because role attributes
251weren't objects. This was never documented, but a few MooseX modules took
252advantage of this.
253
254=item The composition_class_roles attribute in L<Moose::Meta::Role> is now a method
255
256This was done to make it possible for roles to alter the the list of
257composition class roles by applying a method modifiers. Previously, this was
258an attribute and MooseX modules override it. Since that no longer works, this
259was made a method.
260
261This I<should> be an attribute, so this may switch back to being an attribute
262in the future if we can figure out how to make this work.
263
5b7b27e2 264=back
265
c378a61a 266=head1 0.93
267
268=over 4
269
270=item Calling $object->new() is no longer deprecated
271
76c89056 272We decided to undeprecate this. Now it just works.
c378a61a 273
d99ec58b 274=item Both C<get_method_map> and C<get_attribute_map> is deprecated
fa6da135 275
d99ec58b 276These metaclass methods were never meant to be public, and they are both now
277deprecated. The work around if you still need the functionality they provided
278is to iterate over the list of names manually.
fa6da135 279
280 my %fields = map { $_ => $meta->get_attribute($_) } $meta->get_attribute_list;
281
d99ec58b 282This was actually a change in L<Class::MOP>, but this version of Moose
283requires a version of L<Class::MOP> that includes said change.
284
c378a61a 285=back
286
b98ef150 287=head1 0.90
871f82f8 288
c985327a 289=over 4
290
93ef4ba1 291=item Added Native delegation for Code refs
292
293See L<Moose::Meta::Attribute::Native::Trait::Code> for details.
294
3f5ff7d0 295=item Calling $object->new() is deprecated
296
297Moose has long supported this, but it's never really been documented, and we
298don't think this is a good practice. If you want to construct an object from
299an existing object, you should provide some sort of alternate constructor like
300C<< $object->clone >>.
301
302Calling C<< $object->new >> now issues a warning, and will be an error in a
303future release.
304
19e60fdd 305=item Moose no longer warns if you call C<make_immutable> for a class with mutable ancestors
306
307While in theory this is a good thing to warn about, we found so many
308exceptions to this that doing this properly became quite problematic.
309
93ef4ba1 310=back
311
def57e8d 312=head1 0.89_02
93ef4ba1 313
314=over 4
4f0d4488 315
871f82f8 316=item New Native delegation methods from L<List::Util> and L<List::MoreUtils>
317
318In particular, we now have C<reduce>, C<shuffle>, C<uniq>, and C<natatime>.
319
3023f1e4 320=item The Moose::Exporter with_caller feature is now deprecated
321
322Use C<with_meta> instead. The C<with_caller> option will start warning in a
323future release.
324
9b9a5a07 325=item Moose now warns if you call C<make_immutable> for a class with mutable ancestors
326
327This is dangerous because modifying a class after a subclass has been
90b20bd6 328immutabilized will lead to incorrect results in the subclass, due to inlining,
9b9a5a07 329caching, etc. This occasionally happens accidentally, when a class loads one
330of its subclasses in the middle of its class definition, so pointing out that
331this may cause issues should be helpful. Metaclasses (classes that inherit
332from L<Class::MOP::Object>) are currently exempt from this check, since at the
90b20bd6 333moment we aren't very consistent about which metaclasses we immutabilize.
9b9a5a07 334
bce5d4a5 335=item C<enum> and C<duck_type> now take arrayrefs for all forms
336
337Previously, calling these functions with a list would take the first element of
338the list as the type constraint name, and use the remainder as the enum values
339or method names. This makes the interface inconsistent with the anon-type forms
340of these functions (which must take an arrayref), and a free-form list where
341the first value is sometimes special is hard to validate (and harder to give
342reasonable error messages for). These functions have been changed to take
343arrayrefs in all their forms - so, C<< enum 'My::Type' => [qw(foo bar)] >> is
344now the preferred way to create an enum type constraint. The old syntax still
345works for now, but it will hopefully be deprecated and removed in a future
346release.
347
871f82f8 348=back
349
def57e8d 350=head1 0.89_01
a3d98218 351
af44c00c 352L<Moose::Meta::Attribute::Native> has been moved into the Moose core from
a3d98218 353L<MooseX::AttributeHelpers>. Major changes include:
354
ebaaa391 355=over 4
a3d98218 356
357=item C<traits>, not C<metaclass>
358
93ced2bd 359Method providers are only available via traits.
a3d98218 360
361=item C<handles>, not C<provides> or C<curries>
362
93ced2bd 363The C<provides> syntax was like core Moose C<< handles => HASHREF >>
364syntax, but with the keys and values reversed. This was confusing,
365and AttributeHelpers now uses C<< handles => HASHREF >> in a way that
366should be intuitive to anyone already familiar with how it is used for
367other attributes.
a3d98218 368
93ced2bd 369The C<curries> functionality provided by AttributeHelpers has been
370generalized to apply to all cases of C<< handles => HASHREF >>, though
371not every piece of functionality has been ported (currying with a
372CODEREF is not supported).
a3d98218 373
1853a27e 374=item C<empty> is now C<is_empty>, and means empty, not non-empty
af44c00c 375
376Previously, the C<empty> method provided by Arrays and Hashes returned true if
377the attribute was B<not> empty (no elements). Now it returns true if the
1853a27e 378attribute B<is> empty. It was also renamed to C<is_empty>, to reflect this.
af44c00c 379
9a14bd29 380=item C<find> was renamed to C<first>, and C<first> and C<last> were removed
28b96142 381
382L<List::Util> refers to the functionality that we used to provide under C<find>
383as L<first|List::Util/first>, so that will likely be more familiar (and will
9a14bd29 384fit in better if we decide to add more List::Util functions). C<first> and
385C<last> were removed, since their functionality is easily duplicated with
386curries of C<get>.
28b96142 387
388=item Helpers that take a coderef of one argument now use C<$_>
389
390Subroutines passed as the first argument to C<first>, C<map>, and C<grep> now
391receive their argument in C<$_> rather than as a parameter to the subroutine.
392Helpers that take a coderef of two or more arguments remain using the argument
393list (there are technical limitations to using C<$a> and C<$b> like C<sort>
394does).
395
af44c00c 396See L<Moose::Meta::Attribute::Native> for the new documentation.
a3d98218 397
ebaaa391 398=back
399
85e2b15a 400The C<alias> and C<excludes> role parameters have been renamed to C<-alias>
401and C<-excludes>. The old names still work, but new code should use the new
402names, and eventually the old ones will be deprecated and removed.
403
def57e8d 404=head1 0.89
4ada9618 405
8a8856de 406C<< use Moose -metaclass => 'Foo' >> now does alias resolution, just like
407C<-traits> (and the C<metaclass> and C<traits> options to C<has>).
408
27f2f43f 409Added two functions C<meta_class_alias> and C<meta_attribute_alias> to
410L<Moose::Util>, to simplify aliasing metaclasses and metatraits. This is
411a wrapper around the old
412
413 package Moose::Meta::Class::Custom::Trait::FooTrait;
414 sub register_implementation { 'My::Meta::Trait' }
415
416way of doing this.
417
def57e8d 418=head1 0.84
4831e2de 419
9f52cce5 420When an attribute generates I<no> accessors, we now warn. This is to help
421users who forget the C<is> option. If you really do not want any accessors,
3de02fd8 422you can use C<< is => 'bare' >>. You can maintain back compat with older
423versions of Moose by using something like:
424
425 ($Moose::VERSION >= 0.84 ? is => 'bare' : ())
9f52cce5 426
427When an accessor overwrites an existing method, we now warn. To work around
428this warning (if you really must have this behavior), you can explicitly
429remove the method before creating it as an accessor:
430
431 sub foo {}
432
433 __PACKAGE__->meta->remove_method('foo');
434
435 has foo => (
436 is => 'ro',
437 );
438
439When an unknown option is passed to C<has>, we now warn. You can silence
440the warning by fixing your code. :)
441
4831e2de 442The C<Role> type has been deprecated. On its own, it was useless,
443since it just checked C<< $object->can('does') >>. If you were using
444it as a parent type, just call C<role_type('Role::Name')> to create an
445appropriate type instead.
446
def57e8d 447=head1 0.78
7d6b451f 448
449C<use Moose::Exporter;> now imports C<strict> and C<warnings> into packages
450that use it.
451
def57e8d 452=head1 0.77
c3fdacda 453
454C<DEMOLISHALL> and C<DEMOLISH> now receive an argument indicating whether or
455not we are in global destruction.
456
def57e8d 457=head1 0.76
00c61603 458
9f0b3b64 459Type constraints no longer run coercions for a value that already matches the
460constraint. This may affect some (arguably buggy) edge case coercions that
461rely on side effects in the C<via> clause.
462
def57e8d 463=head1 0.75
f869fc4a 464
465L<Moose::Exporter> now accepts the C<-metaclass> option for easily
466overriding the metaclass (without L<metaclass>). This works for classes
467and roles.
468
def57e8d 469=head1 0.74
39ab7714 470
85cf0647 471Added a C<duck_type> sugar function to L<Moose::Util::TypeConstraints>
472to make integration with non-Moose classes easier. It simply checks if
473C<< $obj->can() >> a list of methods.
39ab7714 474
612fd754 475A number of methods (mostly inherited from L<Class::MOP>) have been
476renamed with a leading underscore to indicate their internal-ness. The
477old method names will still work for a while, but will warn that the
478method has been renamed. In a few cases, the method will be removed
479entirely in the future. This may affect MooseX authors who were using
480these methods.
481
def57e8d 482=head1 0.73
600f7f85 483
0f13f53c 484Calling C<subtype> with a name as the only argument now throws an
600f7f85 485exception. If you want an anonymous subtype do:
486
487 my $subtype = subtype as 'Foo';
488
0f13f53c 489This is related to the changes in version 0.71_01.
600f7f85 490
501db4e6 491The C<is_needed> method in L<Moose::Meta::Method::Destructor> is now
492only usable as a class method. Previously, it worked as a class or
493object method, with a different internal implementation for each
494version.
495
496The internals of making a class immutable changed a lot in Class::MOP
4970.78_02, and Moose's internals have changed along with it. The
498external C<< $metaclass->make_immutable >> method still works the same
499way.
500
def57e8d 501=head1 0.72
600f7f85 502
0f13f53c 503A mutable class accepted C<< Foo->new(undef) >> without complaint,
504while an immutable class would blow up with an unhelpful error. Now,
505in both cases we throw a helpful error instead.
600f7f85 506
0f13f53c 507This "feature" was originally added to allow for cases such as this:
600f7f85 508
509 my $args;
0f13f53c 510
511 if ( something() ) {
512 $args = {...};
600f7f85 513 }
0f13f53c 514
600f7f85 515 return My::Class->new($args);
516
0f13f53c 517But we decided this is a bad idea and a little too magical, because it
518can easily mask real errors.
600f7f85 519
def57e8d 520=head1 0.71_01
600f7f85 521
0f13f53c 522Calling C<type> or C<subtype> without the sugar helpers (C<as>,
523C<where>, C<message>) is now deprecated.
524
525As a side effect, this meant we ended up using Perl prototypes on
526C<as>, and code like this will no longer work:
600f7f85 527
528 use Moose::Util::TypeConstraints;
529 use Declare::Constraints::Simple -All;
0f13f53c 530
531 subtype 'ArrayOfInts'
600f7f85 532 => as 'ArrayRef'
533 => IsArrayRef(IsInt);
534
535Instead it must be changed to this:
536
0f13f53c 537 subtype(
538 'ArrayOfInts' => {
539 as => 'ArrayRef',
540 where => IsArrayRef(IsInt)
541 }
600f7f85 542 );
543
0f13f53c 544If you want to maintain backwards compat with older versions of Moose,
545you must explicitly test Moose's C<VERSION>:
600f7f85 546
0f13f53c 547 if ( Moose->VERSION < 0.71_01 ) {
548 subtype 'ArrayOfInts'
600f7f85 549 => as 'ArrayRef'
550 => IsArrayRef(IsInt);
551 }
552 else {
0f13f53c 553 subtype(
554 'ArrayOfInts' => {
555 as => 'ArrayRef',
556 where => IsArrayRef(IsInt)
557 }
600f7f85 558 );
559 }
560
def57e8d 561=head1 0.70
600f7f85 562
0f13f53c 563We no longer pass the meta-attribute object as a final argument to
564triggers. This actually changed for inlined code a while back, but the
565non-inlined version and the docs were still out of date.
566
567If by some chance you actually used this feature, the workaround is
568simple. You fetch the attribute object from out of the C<$self>
569that is passed as the first argument to trigger, like so:
570
571 has 'foo' => (
572 is => 'ro',
573 isa => 'Any',
574 trigger => sub {
575 my ( $self, $value ) = @_;
576 my $attr = $self->meta->find_attribute_by_name('foo');
577
578 # ...
579 }
580 );
600f7f85 581
def57e8d 582=head1 0.66
600f7f85 583
0f13f53c 584If you created a subtype and passed a parent that Moose didn't know
585about, it simply ignored the parent. Now it automatically creates the
586parent as a class type. This may not be what you want, but is less
587broken than before.
600f7f85 588
0f13f53c 589You could declare a name with subtype such as "Foo!Bar". Moose would
590accept this allowed, but if you used it in a parameterized type such
591as "ArrayRef[Foo!Bar]" it wouldn't work. We now do some vetting on
592names created via the sugar functions, so that they can only contain
593alphanumerics, ":", and ".".
600f7f85 594
def57e8d 595=head1 0.65
600f7f85 596
597Methods created via an attribute can now fulfill a C<requires>
0f13f53c 598declaration for a role. Honestly we don't know why Stevan didn't make
599this work originally, he was just insane or something.
600f7f85 600
0f13f53c 601Stack traces from inlined code will now report the line and file as
602being in your class, as opposed to in Moose guts.
600f7f85 603
def57e8d 604=head1 0.62_02
600f7f85 605
0f13f53c 606When a class does not provide all of a role's required methods, the
607error thrown now mentions all of the missing methods, as opposed to
608just the first missing method.
600f7f85 609
0f13f53c 610Moose will no longer inline a constructor for your class unless it
5e26e3f2 611inherits its constructor from Moose::Object, and will warn when it
612doesn't inline. If you want to force inlining anyway, pass
b84f64da 613C<< replace_constructor => 1 >> to C<make_immutable>.
0f13f53c 614
615If you want to get rid of the warning, pass C<< inline_constructor =>
fbf7ba85 6160 >>.
600f7f85 617
def57e8d 618=head1 0.62
600f7f85 619
0f13f53c 620Removed the (deprecated) C<make_immutable> keyword.
600f7f85 621
622Removing an attribute from a class now also removes delegation
0f13f53c 623(C<handles>) methods installed for that attribute. This is correct
600f7f85 624behavior, but if you were wrongly relying on it you might get bit.
625
def57e8d 626=head1 0.58
600f7f85 627
0f13f53c 628Roles now add methods by calling C<add_method>, not
629C<alias_method>. They make sure to always provide a method object,
630which will be cloned internally. This means that it is now possible to
631track the source of a method provided by a role, and even follow its
632history through intermediate roles. This means that methods added by
633a role now show up when looking at a class's method list/map.
634
635Parameter and Union args are now sorted, this makes Int|Str the same
636constraint as Str|Int. Also, incoming type constraint strings are
637normalized to remove all whitespace differences. This is mostly for
638internals and should not affect outside code.
639
640L<Moose::Exporter> will no longer remove a subroutine that the
641exporting package re-exports. Moose re-exports the Carp::confess
642function, among others. The reasoning is that we cannot know whether
643you have also explicitly imported those functions for your own use, so
644we err on the safe side and always keep them.
600f7f85 645
def57e8d 646=head1 0.56
600f7f85 647
0f13f53c 648C<Moose::init_meta> should now be called as a method.
600f7f85 649
0f13f53c 650New modules for extension writers, L<Moose::Exporter> and
651L<Moose::Util::MetaRole>.
600f7f85 652
def57e8d 653=head1 0.55_01
600f7f85 654
655Implemented metaclass traits (and wrote a recipe for it):
656
657 use Moose -traits => 'Foo'
658
659This should make writing small Moose extensions a little
660easier.
661
def57e8d 662=head1 0.55
600f7f85 663
664Fixed C<coerce> to accept anon types just like C<subtype> can.
665So that you can do:
666
667 coerce $some_anon_type => from 'Str' => via { ... };
668
def57e8d 669=head1 0.51
600f7f85 670
52da380a 671Added C<BUILDARGS>, a new step in C<< Moose::Object->new() >>.
600f7f85 672
def57e8d 673=head1 0.49
600f7f85 674
0f13f53c 675Fixed how the C<< is => (ro|rw) >> works with custom defined
676C<reader>, C<writer> and C<accessor> options. See the below table for
600f7f85 677details:
678
679 is => ro, writer => _foo # turns into (reader => foo, writer => _foo)
680 is => rw, writer => _foo # turns into (reader => foo, writer => _foo)
681 is => rw, accessor => _foo # turns into (accessor => _foo)
682 is => ro, accessor => _foo # error, accesor is rw
683
def57e8d 684=head1 0.45
600f7f85 685
0f13f53c 686The C<before/around/after> method modifiers now support regexp
687matching of method names. NOTE: this only works for classes, it is
688currently not supported in roles, but, ... patches welcome.
600f7f85 689
0f13f53c 690The C<has> keyword for roles now accepts the same array ref form that
691L<Moose>.pm does for classes.
600f7f85 692
0f13f53c 693A trigger on a read-only attribute is no longer an error, as it's
694useful to trigger off of the constructor.
600f7f85 695
0f13f53c 696Subtypes of parameterizable types now are parameterizable types
697themselves.
600f7f85 698
def57e8d 699=head1 0.44
600f7f85 700
0f13f53c 701Fixed issue where C<DEMOLISHALL> was eating the value in C<$@>, and so
702not working correctly. It still kind of eats them, but so does vanilla
703perl.
600f7f85 704
def57e8d 705=head1 0.41
600f7f85 706
0f13f53c 707Inherited attributes may now be extended without restriction on the
600f7f85 708type ('isa', 'does').
709
0f13f53c 710The entire set of Moose::Meta::TypeConstraint::* classes were
711refactored in this release. If you were relying on their internals you
712should test your code carefully.
600f7f85 713
def57e8d 714=head1 0.40
600f7f85 715
0f13f53c 716Documenting the use of '+name' with attributes that come from recently
717composed roles. It makes sense, people are using it, and so why not
718just officially support it.
600f7f85 719
0f13f53c 720The C<< Moose::Meta::Class->create >> method now supports roles.
600f7f85 721
86b96832 722It is now possible to make anonymous enum types by passing C<enum> an
723array reference instead of the C<< enum $name => @values >>.
600f7f85 724
def57e8d 725=head1 0.37
600f7f85 726
0f13f53c 727Added the C<make_immutable> keyword as a shortcut to calling
728C<make_immutable> on the meta object. This eventually got removed!
600f7f85 729
0f13f53c 730Made C<< init_arg => undef >> work in Moose. This means "do not accept
600f7f85 731a constructor parameter for this attribute".
732
0f13f53c 733Type errors now use the provided message. Prior to this release they
734didn't.
600f7f85 735
def57e8d 736=head1 0.34
600f7f85 737
738Moose is now a postmodern object system :)
739
0f13f53c 740The Role system was completely refactored. It is 100% backwards
741compat, but the internals were totally changed. If you relied on the
742internals then you are advised to test carefully.
600f7f85 743
744Added method exclusion and aliasing for Roles in this release.
745
0f13f53c 746Added the L<Moose::Util::TypeConstraints::OptimizedConstraints>
747module.
600f7f85 748
0f13f53c 749Passing a list of values to an accessor (which is only expecting one
750value) used to be silently ignored, now it throws an error.
600f7f85 751
def57e8d 752=head1 0.26
600f7f85 753
0f13f53c 754Added parameterized types and did a pretty heavy refactoring of the
755type constraint system.
600f7f85 756
0f13f53c 757Better framework extendability and better support for "making your own
758Moose".
600f7f85 759
def57e8d 760=head1 0.25 or before
600f7f85 761
0f13f53c 762Honestly, you shouldn't be using versions of Moose that are this old,
763so many bug fixes and speed improvements have been made you would be
764crazy to not upgrade.
600f7f85 765
0f13f53c 766Also, I am tired of going through the Changelog so I am stopping here,
767if anyone would like to continue this please feel free.
600f7f85 768
769=head1 AUTHOR
770
771Stevan Little E<lt>stevan@iinteractive.comE<gt>
772
773=head1 COPYRIGHT AND LICENSE
774
775Copyright 2009 by Infinity Interactive, Inc.
776
777L<http://www.iinteractive.com>
778
779This library is free software; you can redistribute it and/or modify
780it under the same terms as Perl itself.
781
0f13f53c 782=cut