- Allow a subclass to set lazy_build for an inherited
attribute. (Dieter Pearcey).
+ * Moose::Meta::Role::Application::ToInstance
+ - Attempting to apply the same role to an object repeatedly is
+ now a no-op after the first application. Previously, doing
+ this to an object instance eventually caused recursion
+ warnings from Perl. Reported by Curtis Poe. RT #43904.
+
0.72 Mon, February 23, 2009
* Moose::Object
* Moose::Meta::Method::Constructor
sub apply {
my ($self, $role, $object) = @_;
+ return
+ if $object->can('meta')
+ && $object->meta->can('does_role')
+ && $object->meta->does_role( $role->name );
+
my $anon_role_key = (blessed($object) . $role->name);
my $class;
use strict;
use warnings;
-use Test::More tests => 27;
+use Test::More tests => 28;
use Scalar::Util qw(blessed);
is(blessed($obj), blessed($obj2), '... they share the same anon-class/role thing again');
}
-
-
-
+SKIP:
+{
+ eval 'use Test::Output;';
+ skip 'This test requires Test::Output', 1
+ if $@;
+
+ my $obj = My::Class->new;
+
+ stderr_is(
+ sub {
+ for ( 1 .. 200 ) {
+ Sleeper->meta->apply($obj);
+ }
+ },
+ q{},
+ 'No warnings when re-applying a role to an object 200 times'
+ );
+}