1Moose::Manual::Delta(3)User Contributed Perl DocumentatioMnoose::Manual::Delta(3)
2
3
4

NAME

6       Moose::Manual::Delta - Important Changes in Moose
7

VERSION

9       version 2.2201
10

DESCRIPTION

12       This documents any important or noteworthy changes in Moose, with a
13       focus on things that affect backwards compatibility. This does
14       duplicate data from the Changes file, but aims to provide more details
15       and when possible workarounds.
16
17       Besides helping keep up with changes, you can also use this document
18       for finding the lowest version of Moose that supported a given feature.
19       If you encounter a problem and have a solution but don't see it
20       documented here, or think we missed an important feature, please send
21       us a patch.
22

2.1400

24       Overloading implementation has changed
25           Overloading meta information used to be implemented by a
26           "Class::MOP::Method::Overload" class. This class has been removed,
27           and overloading is now implemented by Class::MOP::Overload.
28           Overloading is not really equivalent to a method, so the former
29           implementation didn't work properly for various cases.
30
31           All of the overloading-related methods for classes and roles have
32           the same names, but those methods now return Class::MOP::Overload
33           objects.
34
35       Core support for overloading in roles
36           Roles which use overloading now pass that overloading onto other
37           classes (and roles) which consume that role.
38
39           This works much like MooseX::Role::WithOverloading, except that we
40           properly detect overloading conflicts during role summation and
41           when applying one role to another. MooseX::Role::WithOverloading
42           did not do any conflict detection.
43
44           If you want to write code that uses overloading and works with
45           previous versions of Moose and this one, upgrade to
46           MooseX::Role::WithOverloading version 0.15 or greater. That version
47           will detect when Moose itself handles overloading and get out of
48           the way.
49

2.1200

51       Classes created by Moose are now registered in %INC
52           This means that this will no longer die (and will also no longer
53           try to load "Foo.pm"):
54
55             {
56                 package Foo;
57                 use Moose;
58             }
59
60             # ...
61
62             use Foo;
63
64           If you're using the MOP, this behavior will occur when the "create"
65           (or "create_anon_class") method is used, but not when the
66           "initialize" method is used.
67
68       Moose now uses Module::Runtime instead of Class::Load to load classes
69           Class::Load has always had some weird issues with the ways that it
70           tries to figure out if a class is loaded. For instance, extending
71           an empty package was previously impossible, because Class::Load
72           would think that the class failed to load, even though that is a
73           perfectly valid thing to do. It was also difficult to deal with
74           modules like IO::Handle, which partially populate several other
75           packages when they are loaded (so calling "load_class" on
76           'IO::Handle' followed by 'IO::File' could end up with a broken
77           "IO::File", in some cases).
78
79           Now, Moose uses the same mechanisms as perl itself to figure out if
80           a class is loaded. A class is considered to be loaded if its entry
81           in %INC is set. Perl sets the %INC entry for you automatically
82           whenever a file is loaded via "use" or "require". Also, as
83           mentioned above, Moose also now sets the %INC entry for any classes
84           defined with it, even if they aren't loaded from a separate file.
85           This does however mean that if you are trying to use Moose with
86           non-Moose classes defined in the same file, then you will need to
87           set %INC manually now, where it may have worked in the past. For
88           instance:
89
90             {
91                 package My::NonMoose;
92
93                 sub new { bless {}, shift }
94
95                 $INC{'My/NonMoose.pm'} = __FILE__;
96                 # alternatively:
97                 # use Module::Runtime 'module_notional_filename';
98                 # $INC{module_notional_filename(__PACKAGE__)} = __FILE__;
99             }
100
101             {
102                 package My::Moose;
103                 use Moose;
104
105                 extends 'My::NonMoose';
106             }
107
108           If you don't do this, you will get an error message about not being
109           able to locate "My::NonMoose" in @INC. We hope that this case will
110           be fairly rare.
111
112       The Class::Load wrapper functions in Class::MOP have been deprecated
113           "Class::MOP::load_class", "Class::MOP::is_class_loaded", and
114           "Class::MOP::load_first_existing_class" have been deprecated. They
115           have been undocumented and discouraged since version 2.0200. You
116           should replace their use with the corresponding functions in
117           Class::Load, or just use Module::Runtime directly.
118
119       The non-arrayref forms of "enum" and "duck_type" have been deprecated
120           Originally, "enum" could be called like this:
121
122             enum('MyType' => qw(foo bar baz))
123
124           This was confusing, however (since it was different from the syntax
125           for anonymous enum types), and it makes error checking more
126           difficult (since you can't tell just by looking whether
127           "enum('Foo', 'Bar', 'Baz')" was intended to be a type named "Foo"
128           with elements of "Bar" and "Baz", or if this was actually a mistake
129           where someone got the syntax for an anonymous enum type wrong).
130           This all also applies to "duck_type".
131
132           Calling "enum" and "duck_type" with a list of arguments as
133           described above has been undocumented since version 0.93, and is
134           now deprecated. You should replace
135
136             enum MyType => qw(foo bar baz);
137
138           in your code with
139
140             enum MyType => [qw(foo bar baz)];
141
142       Moose string exceptions have been replaced by Moose exception objects
143           Previously, Moose threw string exceptions on error conditions,
144           which were not so verbose. All those string exceptions have now
145           been converted to exception objects, which provide very detailed
146           information about the exceptions. These exception objects provide a
147           string overload that matches the previous exception message, so in
148           most cases you should not have to change your code.
149
150           For learning about the usage of Moose exception objects, read
151           Moose::Manual::Exceptions. Individual exceptions are documented in
152           Moose::Manual::Exceptions::Manifest.
153
154           This work was funded as part of the GNOME Outreach Program for
155           Women.
156

2.1000

158       The Num type is now stricter
159           The "Num" type used to accept anything that fits Perl's notion of a
160           number, which included Inf, NaN, and strings like " 1234 \n".  We
161           believe that the type constraint should indicate "this is a
162           number", not "this coerces to a number".  Therefore, Num now only
163           accepts integers, floating point numbers (both in decimal notation
164           and exponential notation), 0, .0, 0.0, etc.
165
166           If you want the old behavior you can use the "LaxNum" type in
167           MooseX::Types::LaxNum.
168
169       You can use Specio instead of core Moose types
170           The Specio distribution is an experimental new type system intended
171           to eventually replace the core Moose types, but yet also work with
172           things like Moo and Mouse and anything else. Right now this is all
173           speculative, but at least you can use Specio with Moose.
174

2.0600

176       "->init_meta" is even less reliable at loading extensions
177           Previously, calling "MooseX::Foo->init_meta(@_)" (and nothing else)
178           from within your own "init_meta" had a decent chance of doing
179           something useful.  This was never supported behavior, and didn't
180           always work anyway. Due to some implementation adjustments, this
181           now has a smaller chance of doing something useful, which could
182           break code that was expecting it to continue doing useful things.
183           Code that does this should instead just call "MooseX::Foo->import({
184           into => $into })".
185
186       All the Cookbook recipes have been renamed
187           We've given them all descriptive names, rather than numbers. This
188           makes it easier to talk about them, and eliminates the need to
189           renumber recipes in order to reorder them or delete one.
190

2.0400

192       The parent of a union type is its components' nearest common ancestor
193           Previously, union types considered all of their component types
194           their parent types. This was incorrect because parent types are
195           defined as types that must be satisfied in order for the child type
196           to be satisfied, but in a union, validating as any parent type will
197           validate against the entire union. This has been changed to find
198           the nearest common ancestor for all of its components. For example,
199           a union of "Int|ArrayRef[Int]" now has a parent of "Defined".
200
201       Union types consider all members in the "is_subtype_of" and
202       "is_a_type_of" methods
203           Previously, a union type would report itself as being of a subtype
204           of a type if any of its member types were subtypes of that type.
205           This was incorrect because any value that passes a subtype
206           constraint must also pass a parent constraint. This has changed so
207           that all of its member types must be a subtype of the specified
208           type.
209
210       Enum types now work with just one value
211           Previously, an "enum" type needed to have two or more values.
212           Nobody knew why, so we fixed it.
213
214       Methods defined in UNIVERSAL now appear in the MOP
215           Any method introspection methods that look at methods from parent
216           classes now find methods defined in UNIVERSAL. This includes
217           methods like "$class->get_all_methods" and
218           "$class->find_method_by_name".
219
220           This also means that you can now apply method modifiers to these
221           methods.
222
223       Hand-optimized type constraint code causes a deprecation warning
224           If you provide an optimized sub ref for a type constraint, this now
225           causes a deprecation warning. Typically, this comes from passing an
226           "optimize_as" parameter to "subtype", but it could also happen if
227           you create a Moose::Meta::TypeConstraint object directly.
228
229           Use the inlining feature ("inline_as") added in 2.0100 instead.
230
231       "Class::Load::load_class" and "is_class_loaded" have been removed
232           The "Class::MOP::load_class" and "Class::MOP::is_class_loaded"
233           subroutines are no longer documented, and will cause a deprecation
234           warning in the future. Moose now uses Class::Load to provide this
235           functionality, and you should do so as well.
236

2.0205

238       Array and Hash native traits provide a "shallow_clone" method
239           The Array and Hash native traits now provide a "shallow_clone"
240           method, which will return a reference to a new container with the
241           same contents as the attribute's reference.
242

2.0200

244       Hand-optimized type constraint code is deprecated in favor of inlining
245           Moose allows you to provide a hand-optimized version of a type
246           constraint's subroutine reference. This version allows type
247           constraints to generate inline code, and you should use this
248           inlining instead of providing a hand-optimized subroutine
249           reference.
250
251           This affects the "optimize_as" sub exported by
252           Moose::Util::TypeConstraints. Use "inline_as" instead.
253
254           This will start warning in the 2.0300 release.
255

2.0002

257       More useful type constraint error messages
258           If you have Devel::PartialDump version 0.14 or higher installed,
259           Moose's type constraint error messages will use it to display the
260           invalid value, rather than just displaying it directly. This will
261           generally be much more useful. For instance, instead of this:
262
263             Attribute (foo) does not pass the type constraint because: Validation failed for 'ArrayRef[Int]' with value ARRAY(0x275eed8)
264
265           the error message will instead look like
266
267             Attribute (foo) does not pass the type constraint because: Validation failed for 'ArrayRef[Int]' with value [ "a" ]
268
269           Note that Devel::PartialDump can't be made a direct dependency at
270           the moment, because it uses Moose itself, but we're considering
271           options to make this easier.
272

2.0000

274       Roles have their own default attribute metaclass
275           Previously, when a role was applied to a class, it would use the
276           attribute metaclass defined in the class when copying over the
277           attributes in the role.  This was wrong, because for instance,
278           using MooseX::FollowPBP in the class would end up renaming all of
279           the accessors generated by the role, some of which may be being
280           called in the role, causing it to break. Roles now keep track of
281           their own attribute metaclass to use by default when being applied
282           to a class (defaulting to Moose::Meta::Attribute). This is
283           modifiable using Moose::Util::MetaRole by passing the
284           "applied_attribute" key to the "role_metaroles" option, as in:
285
286               Moose::Util::MetaRole::apply_metaroles(
287                   for => __PACKAGE__,
288                   class_metaroles => {
289                       attribute => ['My::Meta::Role::Attribute'],
290                   },
291                   role_metaroles => {
292                       applied_attribute => ['My::Meta::Role::Attribute'],
293                   },
294               );
295
296       Class::MOP has been folded into the Moose dist
297           Moose and Class::MOP are tightly related enough that they have
298           always had to be kept pretty closely in step in terms of versions.
299           Making them into a single dist should simplify the upgrade process
300           for users, as it should no longer be possible to upgrade one
301           without the other and potentially cause issues. No functionality
302           has changed, and this should be entirely transparent.
303
304       Moose's conflict checking is more robust and useful
305           There are two parts to this. The most useful one right now is that
306           Moose will ship with a "moose-outdated" script, which can be run at
307           any point to list the modules which are installed that conflict
308           with the installed version of Moose.  After upgrading Moose,
309           running "moose-outdated | cpanm" should be sufficient to ensure
310           that all of the Moose extensions you use will continue to work.
311
312           The other part is that Moose's "META.json" file will also specify
313           the conflicts under the "x_conflicts" (now "x_breaks") key. We are
314           working with the Perl tool chain developers to try to get conflicts
315           support added to CPAN clients, and if/when that happens, the
316           metadata already exists, and so the conflict checking will become
317           automatic.
318
319       The lazy_build attribute feature is discouraged
320           While not deprecated, we strongly discourage you from using this
321           feature.
322
323       Most deprecated APIs/features are slated for removal in Moose 2.0200
324           Most of the deprecated APIs and features in Moose will start
325           throwing an error in Moose 2.0200. Some of the features will go
326           away entirely, and some will simply throw an error.
327
328           The things on the chopping block are:
329
330           •       Old public methods in Class::MOP and Moose
331
332                   This includes things like
333                   "Class::MOP::Class->get_attribute_map",
334                   "Class::MOP::Class->construct_instance", and many others.
335                   These were deprecated in Class::MOP 0.80_01, released on
336                   April 5, 2009.
337
338                   These methods will be removed entirely in Moose 2.0200.
339
340           •       Old public functions in Class::MOP
341
342                   This include "Class::MOP::subname",
343                   "Class::MOP::in_global_destruction", and the
344                   "Class::MOP::HAS_ISAREV" constant. The first two were
345                   deprecated in 0.84, and the last in 0.80. Class::MOP 0.84
346                   was released on May 12, 2009.
347
348                   These functions will be removed entirely in Moose 2.0200.
349
350           •       The "alias" and "excludes" option for role composition
351
352                   These were renamed to "-alias" and "-excludes" in Moose
353                   0.89, released on August 13, 2009.
354
355                   Passing these will throw an error in Moose 2.0200.
356
357           •       The old Moose::Util::MetaRole API
358
359                   This include the "apply_metaclass_roles()" function, as
360                   well as passing the "for_class" or any key ending in
361                   "_roles" to "apply_metaroles()". This was deprecated in
362                   Moose 0.93_01, released on January 4, 2010.
363
364                   These will all throw an error in Moose 2.0200.
365
366           •       Passing plain lists to "type()" or "subtype()"
367
368                   The old API for these functions allowed you to pass a plain
369                   list of parameter, rather than a list of hash references
370                   (which is what "as()", "where", etc. return). This was
371                   deprecated in Moose 0.71_01, released on February 22, 2009.
372
373                   This will throw an error in Moose 2.0200.
374
375           •       The Role subtype
376
377                   This subtype was deprecated in Moose 0.84, released on June
378                   26, 2009.
379
380                   This will be removed entirely in Moose 2.0200.
381

1.21

383       •   New release policy
384
385           As of the 2.0 release, Moose now has an official release and
386           support policy, documented in Moose::Manual::Support. All API
387           changes will now go through a deprecation cycle of at least one
388           year, after which the deprecated API can be removed. Deprecations
389           and removals will only happen in major releases.
390
391           In between major releases, we will still make minor releases to add
392           new features, fix bugs, update documentation, etc.
393

1.16

395       Configurable stacktraces
396           Classes which use the Moose::Error::Default error class can now
397           have stacktraces disabled by setting the "MOOSE_ERROR_STYLE" env
398           var to "croak".  This is experimental, fairly incomplete, and won't
399           work in all cases (because Moose's error system in general is all
400           of these things), but this should allow for reducing at least some
401           of the verbosity in most cases.
402

1.15

404       Native Delegations
405           In previous versions of Moose, the Native delegations were created
406           as closures. The generated code was often quite slow compared to
407           doing the same thing by hand. For example, the Array's push
408           delegation ended up doing something like this:
409
410             push @{ $self->$reader() }, @_;
411
412           If the attribute was created without a reader, the $reader sub
413           reference followed a very slow code path. Even with a reader, this
414           is still slower than it needs to be.
415
416           Native delegations are now generated as inline code, just like
417           other accessors, so we can access the slot directly.
418
419           In addition, native traits now do proper constraint checking in all
420           cases. In particular, constraint checking has been improved for
421           array and hash references. Previously, only the contained type (the
422           "Str" in "HashRef[Str]") would be checked when a new value was
423           added to the collection. However, if there was a constraint that
424           applied to the whole value, this was never checked.
425
426           In addition, coercions are now called on the whole value.
427
428           The delegation methods now do more argument checking. All of the
429           methods check that a valid number of arguments were passed to the
430           method. In addition, the delegation methods check that the
431           arguments are sane (array indexes, hash keys, numbers, etc.) when
432           applicable. We have tried to emulate the behavior of Perl builtins
433           as much as possible.
434
435           Finally, triggers are called whenever the value of the attribute is
436           changed by a Native delegation.
437
438           These changes are only likely to break code in a few cases.
439
440           The inlining code may or may not preserve the original reference
441           when changes are made. In some cases, methods which change the
442           value may replace it entirely. This will break tied values.
443
444           If you have a typed arrayref or hashref attribute where the type
445           enforces a constraint on the whole collection, this constraint will
446           now be checked. It's possible that code which previously ran
447           without errors will now cause the constraint to fail. However,
448           presumably this is a good thing ;)
449
450           If you are passing invalid arguments to a delegation which were
451           previously being ignored, these calls will now fail.
452
453           If your code relied on the trigger only being called for a regular
454           writer, that may cause problems.
455
456           As always, you are encouraged to test before deploying the latest
457           version of Moose to production.
458
459       Defaults is and default for String, Counter, and Bool
460           A few native traits (String, Counter, Bool) provide default values
461           of "is" and "default" when you created an attribute. Allowing them
462           to provide these values is now deprecated. Supply the value
463           yourself when creating the attribute.
464
465       The "meta" method
466           Moose and Class::MOP have been cleaned up internally enough to make
467           the "meta" method that you get by default optional. "use Moose" and
468           "use Moose::Role" now can take an additional "-meta_name" option,
469           which tells Moose what name to use when installing the "meta"
470           method. Passing "undef" to this option suppresses generation of the
471           "meta" method entirely. This should be useful for users of modules
472           which also use a "meta" method or function, such as Curses or
473           Rose::DB::Object.
474

1.09

476       All deprecated features now warn
477           Previously, deprecation mostly consisted of simply saying "X is
478           deprecated" in the Changes file. We were not very consistent about
479           actually warning. Now, all deprecated features still present in
480           Moose actually give a warning. The warning is issued once per
481           calling package. See Moose::Deprecated for more details.
482
483       You cannot pass "coerce => 1" unless the attribute's type constraint
484       has a coercion
485           Previously, this was accepted, and it sort of worked, except that
486           if you attempted to set the attribute after the object was created,
487           you would get a runtime error.
488
489           Now you will get a warning when you attempt to define the
490           attribute.
491
492       "no Moose", "no Moose::Role", and "no Moose::Exporter" no longer
493       unimport strict and warnings
494           This change was made in 1.05, and has now been reverted. We don't
495           know if the user has explicitly loaded strict or warnings on their
496           own, and unimporting them is just broken in that case.
497
498       Reversed logic when defining which options can be changed
499           Moose::Meta::Attribute now allows all options to be changed in an
500           overridden attribute. The previous behaviour required each option
501           to be whitelisted using the "legal_options_for_inheritance" method.
502           This method has been removed, and there is a new method,
503           "illegal_options_for_inheritance", which can now be used to prevent
504           certain options from being changeable.
505
506           In addition, we only throw an error if the illegal option is
507           actually changed. If the superclass didn't specify this option at
508           all when defining the attribute, the subclass version can still add
509           it as an option.
510
511           Example of overriding this in an attribute trait:
512
513             package Bar::Meta::Attribute;
514             use Moose::Role;
515
516             has 'my_illegal_option' => (
517                 isa => 'CodeRef',
518                 is  => 'rw',
519             );
520
521             around illegal_options_for_inheritance => sub {
522                 return ( shift->(@_), qw/my_illegal_option/ );
523             };
524

1.05

526       "BUILD" in Moose::Object methods are now called when calling
527       "new_object"
528           Previously, "BUILD" methods would only be called from
529           "Moose::Object::new", but now they are also called when
530           constructing an object via "Moose::Meta::Class::new_object".
531           "BUILD" methods are an inherent part of the object construction
532           process, and this should make "$meta->new_object" actually usable
533           without forcing people to use "$meta->name->new".
534
535       "no Moose", "no Moose::Role", and "no Moose::Exporter" now unimport
536       strict and warnings
537           In the interest of having "no Moose" clean up everything that "use
538           Moose" does in the calling scope, "no Moose" (as well as all other
539           Moose::Exporter-using modules) now unimports strict and warnings.
540
541       Metaclass compatibility checking and fixing should be much more robust
542           The metaclass compatibility checking and fixing algorithms have
543           been completely rewritten, in both Class::MOP and Moose. This
544           should resolve many confusing errors when dealing with non-Moose
545           inheritance and with custom metaclasses for things like attributes,
546           constructors, etc. For correct code, the only thing that should
547           require a change is that custom error metaclasses must now inherit
548           from Moose::Error::Default.
549

1.02

551       Moose::Meta::TypeConstraint::Class is_subtype_of behavior
552           Earlier versions of is_subtype_of would incorrectly return true
553           when called with itself, its own TC name or its class name as an
554           argument. (i.e. $foo_tc->is_subtype_of('Foo') == 1) This behavior
555           was a caused by "isa" being checked before the class name. The old
556           behavior can be accessed with is_type_of
557

1.00

559       Moose::Meta::Attribute::Native::Trait::Code no longer creates reader
560       methods by default
561           Earlier versions of Moose::Meta::Attribute::Native::Trait::Code
562           created read-only accessors for the attributes it's been applied
563           to, even if you didn't ask for it with "is => 'ro'". This incorrect
564           behaviour has now been fixed.
565

0.95

567       Moose::Util add_method_modifier behavior
568           add_method_modifier (and subsequently the sugar functions
569           Moose::before, Moose::after, and Moose::around) can now accept
570           arrayrefs, with the same behavior as lists. Types other than
571           arrayref and regexp result in an error.
572

0.93_01 and 0.94

574       Moose::Util::MetaRole API has changed
575           The "apply_metaclass_roles" function is now called
576           "apply_metaroles". The way arguments are supplied has been changed
577           to force you to distinguish between metaroles applied to
578           Moose::Meta::Class (and helpers) versus Moose::Meta::Role.
579
580           The old API still works, but will warn in a future release, and
581           eventually be removed.
582
583       Moose::Meta::Role has real attributes
584           The attributes returned by Moose::Meta::Role are now instances of
585           the Moose::Meta::Role::Attribute class, instead of bare hash
586           references.
587
588       "no Moose" now removes "blessed" and "confess"
589           Moose is now smart enough to know exactly what it exported, even
590           when it re-exports functions from other packages. When you unimport
591           Moose, it will remove these functions from your namespace unless
592           you also imported them directly from their respective packages.
593
594           If you have a "no Moose" in your code before you call "blessed" or
595           "confess", your code will break. You can either move the "no Moose"
596           call later in your code, or explicitly import the relevant
597           functions from the packages that provide them.
598
599       Moose::Exporter is smarter about unimporting re-exports
600           The change above comes from a general improvement to
601           Moose::Exporter. It will now unimport any function it exports, even
602           if that function is a re-export from another package.
603
604       Attributes in roles can no longer override class attributes with "+foo"
605           Previously, this worked more or less accidentally, because role
606           attributes weren't objects. This was never documented, but a few
607           MooseX modules took advantage of this.
608
609       The composition_class_roles attribute in Moose::Meta::Role is now a
610       method
611           This was done to make it possible for roles to alter the list of
612           composition class roles by applying a method modifiers. Previously,
613           this was an attribute and MooseX modules override it. Since that no
614           longer works, this was made a method.
615
616           This should be an attribute, so this may switch back to being an
617           attribute in the future if we can figure out how to make this work.
618

0.93

620       Calling $object->new() is no longer deprecated
621           We decided to undeprecate this. Now it just works.
622
623       Both "get_method_map" and "get_attribute_map" is deprecated
624           These metaclass methods were never meant to be public, and they are
625           both now deprecated. The work around if you still need the
626           functionality they provided is to iterate over the list of names
627           manually.
628
629               my %fields = map { $_ => $meta->get_attribute($_) } $meta->get_attribute_list;
630
631           This was actually a change in Class::MOP, but this version of Moose
632           requires a version of Class::MOP that includes said change.
633

0.90

635       Added Native delegation for Code refs
636           See Moose::Meta::Attribute::Native::Trait::Code for details.
637
638       Calling $object->new() is deprecated
639           Moose has long supported this, but it's never really been
640           documented, and we don't think this is a good practice. If you want
641           to construct an object from an existing object, you should provide
642           some sort of alternate constructor like "$object->clone".
643
644           Calling "$object->new" now issues a warning, and will be an error
645           in a future release.
646
647       Moose no longer warns if you call "make_immutable" for a class with
648       mutable ancestors
649           While in theory this is a good thing to warn about, we found so
650           many exceptions to this that doing this properly became quite
651           problematic.
652

0.89_02

654       New Native delegation methods from List::Util and List::MoreUtils
655           In particular, we now have "reduce", "shuffle", "uniq", and
656           "natatime".
657
658       The Moose::Exporter with_caller feature is now deprecated
659           Use "with_meta" instead. The "with_caller" option will start
660           warning in a future release.
661
662       Moose now warns if you call "make_immutable" for a class with mutable
663       ancestors
664           This is dangerous because modifying a class after a subclass has
665           been immutabilized will lead to incorrect results in the subclass,
666           due to inlining, caching, etc. This occasionally happens
667           accidentally, when a class loads one of its subclasses in the
668           middle of its class definition, so pointing out that this may cause
669           issues should be helpful. Metaclasses (classes that inherit from
670           Class::MOP::Object) are currently exempt from this check, since at
671           the moment we aren't very consistent about which metaclasses we
672           immutabilize.
673
674       "enum" and "duck_type" now take arrayrefs for all forms
675           Previously, calling these functions with a list would take the
676           first element of the list as the type constraint name, and use the
677           remainder as the enum values or method names. This makes the
678           interface inconsistent with the anon-type forms of these functions
679           (which must take an arrayref), and a free-form list where the first
680           value is sometimes special is hard to validate (and harder to give
681           reasonable error messages for). These functions have been changed
682           to take arrayrefs in all their forms - so, "enum 'My::Type' =>
683           [qw(foo bar)]" is now the preferred way to create an enum type
684           constraint. The old syntax still works for now, but it will
685           hopefully be deprecated and removed in a future release.
686

0.89_01

688       Moose::Meta::Attribute::Native has been moved into the Moose core from
689       MooseX::AttributeHelpers.  Major changes include:
690
691       "traits", not "metaclass"
692           Method providers are only available via traits.
693
694       "handles", not "provides" or "curries"
695           The "provides" syntax was like core Moose "handles => HASHREF"
696           syntax, but with the keys and values reversed.  This was confusing,
697           and AttributeHelpers now uses "handles => HASHREF" in a way that
698           should be intuitive to anyone already familiar with how it is used
699           for other attributes.
700
701           The "curries" functionality provided by AttributeHelpers has been
702           generalized to apply to all cases of "handles => HASHREF", though
703           not every piece of functionality has been ported (currying with a
704           CODEREF is not supported).
705
706       "empty" is now "is_empty", and means empty, not non-empty
707           Previously, the "empty" method provided by Arrays and Hashes
708           returned true if the attribute was not empty (no elements).  Now it
709           returns true if the attribute is empty. It was also renamed to
710           "is_empty", to reflect this.
711
712       "find" was renamed to "first", and "first" and "last" were removed
713           List::Util refers to the functionality that we used to provide
714           under "find" as first, so that will likely be more familiar (and
715           will fit in better if we decide to add more List::Util functions).
716           "first" and "last" were removed, since their functionality is
717           easily duplicated with curries of "get".
718
719       Helpers that take a coderef of one argument now use $_
720           Subroutines passed as the first argument to "first", "map", and
721           "grep" now receive their argument in $_ rather than as a parameter
722           to the subroutine.  Helpers that take a coderef of two or more
723           arguments remain using the argument list (there are technical
724           limitations to using $a and $b like "sort" does).
725
726           See Moose::Meta::Attribute::Native for the new documentation.
727
728       The "alias" and "excludes" role parameters have been renamed to
729       "-alias" and "-excludes". The old names still work, but new code should
730       use the new names, and eventually the old ones will be deprecated and
731       removed.
732

0.89

734       "use Moose -metaclass => 'Foo'" now does alias resolution, just like
735       "-traits" (and the "metaclass" and "traits" options to "has").
736
737       Added two functions "meta_class_alias" and "meta_attribute_alias" to
738       Moose::Util, to simplify aliasing metaclasses and metatraits. This is a
739       wrapper around the old
740
741         package Moose::Meta::Class::Custom::Trait::FooTrait;
742         sub register_implementation { 'My::Meta::Trait' }
743
744       way of doing this.
745

0.84

747       When an attribute generates no accessors, we now warn. This is to help
748       users who forget the "is" option. If you really do not want any
749       accessors, you can use "is => 'bare'". You can maintain back compat
750       with older versions of Moose by using something like:
751
752           ($Moose::VERSION >= 0.84 ? is => 'bare' : ())
753
754       When an accessor overwrites an existing method, we now warn. To work
755       around this warning (if you really must have this behavior), you can
756       explicitly remove the method before creating it as an accessor:
757
758           sub foo {}
759
760           __PACKAGE__->meta->remove_method('foo');
761
762           has foo => (
763               is => 'ro',
764           );
765
766       When an unknown option is passed to "has", we now warn. You can silence
767       the warning by fixing your code. :)
768
769       The "Role" type has been deprecated. On its own, it was useless, since
770       it just checked "$object->can('does')". If you were using it as a
771       parent type, just call "role_type('Role::Name')" to create an
772       appropriate type instead.
773

0.78

775       "use Moose::Exporter;" now imports "strict" and "warnings" into
776       packages that use it.
777

0.77

779       "DEMOLISHALL" and "DEMOLISH" now receive an argument indicating whether
780       or not we are in global destruction.
781

0.76

783       Type constraints no longer run coercions for a value that already
784       matches the constraint.  This may affect some (arguably buggy) edge
785       case coercions that rely on side effects in the "via" clause.
786

0.75

788       Moose::Exporter now accepts the "-metaclass" option for easily
789       overriding the metaclass (without metaclass). This works for classes
790       and roles.
791

0.74

793       Added a "duck_type" sugar function to Moose::Util::TypeConstraints to
794       make integration with non-Moose classes easier. It simply checks if
795       "$obj->can()" a list of methods.
796
797       A number of methods (mostly inherited from Class::MOP) have been
798       renamed with a leading underscore to indicate their internal-ness. The
799       old method names will still work for a while, but will warn that the
800       method has been renamed. In a few cases, the method will be removed
801       entirely in the future. This may affect MooseX authors who were using
802       these methods.
803

0.73

805       Calling "subtype" with a name as the only argument now throws an
806       exception. If you want an anonymous subtype do:
807
808           my $subtype = subtype as 'Foo';
809
810       This is related to the changes in version 0.71_01.
811
812       The "is_needed" method in Moose::Meta::Method::Destructor is now only
813       usable as a class method. Previously, it worked as a class or object
814       method, with a different internal implementation for each version.
815
816       The internals of making a class immutable changed a lot in Class::MOP
817       0.78_02, and Moose's internals have changed along with it. The external
818       "$metaclass->make_immutable" method still works the same way.
819

0.72

821       A mutable class accepted "Foo->new(undef)" without complaint, while an
822       immutable class would blow up with an unhelpful error. Now, in both
823       cases we throw a helpful error instead.
824
825       This "feature" was originally added to allow for cases such as this:
826
827         my $args;
828
829         if ( something() ) {
830             $args = {...};
831         }
832
833         return My::Class->new($args);
834
835       But we decided this is a bad idea and a little too magical, because it
836       can easily mask real errors.
837

0.71_01

839       Calling "type" or "subtype" without the sugar helpers ("as", "where",
840       "message") is now deprecated.
841
842       As a side effect, this meant we ended up using Perl prototypes on "as",
843       and code like this will no longer work:
844
845         use Moose::Util::TypeConstraints;
846         use Declare::Constraints::Simple -All;
847
848         subtype 'ArrayOfInts'
849             => as 'ArrayRef'
850             => IsArrayRef(IsInt);
851
852       Instead it must be changed to this:
853
854         subtype(
855             'ArrayOfInts' => {
856                 as    => 'ArrayRef',
857                 where => IsArrayRef(IsInt)
858             }
859         );
860
861       If you want to maintain backwards compat with older versions of Moose,
862       you must explicitly test Moose's "VERSION":
863
864         if ( Moose->VERSION < 0.71_01 ) {
865             subtype 'ArrayOfInts'
866                 => as 'ArrayRef'
867                 => IsArrayRef(IsInt);
868         }
869         else {
870             subtype(
871                 'ArrayOfInts' => {
872                     as    => 'ArrayRef',
873                     where => IsArrayRef(IsInt)
874                 }
875             );
876         }
877

0.70

879       We no longer pass the meta-attribute object as a final argument to
880       triggers. This actually changed for inlined code a while back, but the
881       non-inlined version and the docs were still out of date.
882
883       If by some chance you actually used this feature, the workaround is
884       simple. You fetch the attribute object from out of the $self that is
885       passed as the first argument to trigger, like so:
886
887         has 'foo' => (
888             is      => 'ro',
889             isa     => 'Any',
890             trigger => sub {
891                 my ( $self, $value ) = @_;
892                 my $attr = $self->meta->find_attribute_by_name('foo');
893
894                 # ...
895             }
896         );
897

0.66

899       If you created a subtype and passed a parent that Moose didn't know
900       about, it simply ignored the parent. Now it automatically creates the
901       parent as a class type. This may not be what you want, but is less
902       broken than before.
903
904       You could declare a name with subtype such as "Foo!Bar". Moose would
905       accept this allowed, but if you used it in a parameterized type such as
906       "ArrayRef[Foo!Bar]" it wouldn't work. We now do some vetting on names
907       created via the sugar functions, so that they can only contain
908       alphanumerics, ":", and ".".
909

0.65

911       Methods created via an attribute can now fulfill a "requires"
912       declaration for a role. Honestly we don't know why Stevan didn't make
913       this work originally, he was just insane or something.
914
915       Stack traces from inlined code will now report the line and file as
916       being in your class, as opposed to in Moose guts.
917

0.62_02

919       When a class does not provide all of a role's required methods, the
920       error thrown now mentions all of the missing methods, as opposed to
921       just the first missing method.
922
923       Moose will no longer inline a constructor for your class unless it
924       inherits its constructor from Moose::Object, and will warn when it
925       doesn't inline. If you want to force inlining anyway, pass
926       "replace_constructor => 1" to "make_immutable".
927
928       If you want to get rid of the warning, pass "inline_constructor => 0".
929

0.62

931       Removed the (deprecated) "make_immutable" keyword.
932
933       Removing an attribute from a class now also removes delegation
934       ("handles") methods installed for that attribute. This is correct
935       behavior, but if you were wrongly relying on it you might get bit.
936

0.58

938       Roles now add methods by calling "add_method", not "alias_method". They
939       make sure to always provide a method object, which will be cloned
940       internally. This means that it is now possible to track the source of a
941       method provided by a role, and even follow its history through
942       intermediate roles.  This means that methods added by a role now show
943       up when looking at a class's method list/map.
944
945       Parameter and Union args are now sorted, this makes Int|Str the same
946       constraint as Str|Int. Also, incoming type constraint strings are
947       normalized to remove all whitespace differences. This is mostly for
948       internals and should not affect outside code.
949
950       Moose::Exporter will no longer remove a subroutine that the exporting
951       package re-exports. Moose re-exports the Carp::confess function, among
952       others. The reasoning is that we cannot know whether you have also
953       explicitly imported those functions for your own use, so we err on the
954       safe side and always keep them.
955

0.56

957       "Moose::init_meta" should now be called as a method.
958
959       New modules for extension writers, Moose::Exporter and
960       Moose::Util::MetaRole.
961

0.55_01

963       Implemented metaclass traits (and wrote a recipe for it):
964
965         use Moose -traits => 'Foo'
966
967       This should make writing small Moose extensions a little easier.
968

0.55

970       Fixed "coerce" to accept anon types just like "subtype" can.  So that
971       you can do:
972
973         coerce $some_anon_type => from 'Str' => via { ... };
974

0.51

976       Added "BUILDARGS", a new step in "Moose::Object->new()".
977

0.49

979       Fixed how the "is => (ro|rw)" works with custom defined "reader",
980       "writer" and "accessor" options. See the below table for details:
981
982         is => ro, writer => _foo    # turns into (reader => foo, writer => _foo)
983         is => rw, writer => _foo    # turns into (reader => foo, writer => _foo)
984         is => rw, accessor => _foo  # turns into (accessor => _foo)
985         is => ro, accessor => _foo  # error, accesor is rw
986

0.45

988       The "before/around/after" method modifiers now support regexp matching
989       of method names. NOTE: this only works for classes, it is currently not
990       supported in roles, but, ... patches welcome.
991
992       The "has" keyword for roles now accepts the same array ref form that
993       Moose.pm does for classes.
994
995       A trigger on a read-only attribute is no longer an error, as it's
996       useful to trigger off of the constructor.
997
998       Subtypes of parameterizable types now are parameterizable types
999       themselves.
1000

0.44

1002       Fixed issue where "DEMOLISHALL" was eating the value in $@, and so not
1003       working correctly. It still kind of eats them, but so does vanilla
1004       perl.
1005

0.41

1007       Inherited attributes may now be extended without restriction on the
1008       type ('isa', 'does').
1009
1010       The entire set of Moose::Meta::TypeConstraint::* classes were
1011       refactored in this release. If you were relying on their internals you
1012       should test your code carefully.
1013

0.40

1015       Documenting the use of '+name' with attributes that come from recently
1016       composed roles. It makes sense, people are using it, and so why not
1017       just officially support it.
1018
1019       The "Moose::Meta::Class->create" method now supports roles.
1020
1021       It is now possible to make anonymous enum types by passing "enum" an
1022       array reference instead of the "enum $name => @values".
1023

0.37

1025       Added the "make_immutable" keyword as a shortcut to calling
1026       "make_immutable" on the meta object. This eventually got removed!
1027
1028       Made "init_arg => undef" work in Moose. This means "do not accept a
1029       constructor parameter for this attribute".
1030
1031       Type errors now use the provided message. Prior to this release they
1032       didn't.
1033

0.34

1035       Moose is now a postmodern object system :)
1036
1037       The Role system was completely refactored. It is 100% backwards compat,
1038       but the internals were totally changed. If you relied on the internals
1039       then you are advised to test carefully.
1040
1041       Added method exclusion and aliasing for Roles in this release.
1042
1043       Added the Moose::Util::TypeConstraints::OptimizedConstraints module.
1044
1045       Passing a list of values to an accessor (which is only expecting one
1046       value) used to be silently ignored, now it throws an error.
1047

0.26

1049       Added parameterized types and did a pretty heavy refactoring of the
1050       type constraint system.
1051
1052       Better framework extensibility and better support for "making your own
1053       Moose".
1054

0.25 or before

1056       Honestly, you shouldn't be using versions of Moose that are this old,
1057       so many bug fixes and speed improvements have been made you would be
1058       crazy to not upgrade.
1059
1060       Also, I am tired of going through the Changelog so I am stopping here,
1061       if anyone would like to continue this please feel free.
1062

AUTHORS

1064       •   Stevan Little <stevan@cpan.org>
1065
1066       •   Dave Rolsky <autarch@urth.org>
1067
1068       •   Jesse Luehrs <doy@cpan.org>
1069
1070       •   Shawn M Moore <sartak@cpan.org>
1071
1072       •   יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
1073
1074       •   Karen Etheridge <ether@cpan.org>
1075
1076       •   Florian Ragwitz <rafl@debian.org>
1077
1078       •   Hans Dieter Pearcey <hdp@cpan.org>
1079
1080       •   Chris Prather <chris@prather.org>
1081
1082       •   Matt S Trout <mstrout@cpan.org>
1083
1085       This software is copyright (c) 2006 by Infinity Interactive, Inc.
1086
1087       This is free software; you can redistribute it and/or modify it under
1088       the same terms as the Perl 5 programming language system itself.
1089
1090
1091
1092perl v5.36.0                      2022-07-22           Moose::Manual::Delta(3)
Impressum