Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 73449
Status: new
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: TRLORENZ [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.0000
Fixed in: (no value)



Subject: During a rebless, triggers will fire for any attributes that have an undefined init_arg and began the rebless with a value.
During a rebless, triggers will fire for any attributes that have an undefined init_arg and began the rebless with a value. Triggers shouldn't fire in this case. The value is simply being assumed by the reblessed instance -- it isn't being set in an "interesting" way. It looks to me like this will have been a bug since at least as far back as 2.00. ===== use Test::More; { package MyClass; use Moose; our $FIRINGS; has foo => ( init_arg => undef, is => 'rw', isa => 'Any', trigger => sub { $FIRINGS++ }, ); } { package MyClass::Extended; use Moose; extends 'MyClass'; } TODO: { local $TODO = 'bug demo'; my $obj = MyClass->new; $obj->foo('FOO'); $MyClass::FIRINGS = 0; MyClass::Extended->meta->rebless_instance($obj); cmp_ok(MyClass::FIRINGS, '==', 0, 'trigger did NOT fire'); } ===== The problem may lie in CMOP::Class::_fixup_attributes_after_rebless, where such attributes are fixed up via set_value, which entails a trigger call.