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