Skip Menu |
Update: The bug tracker service is no longer shutting down.

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Mouse CPAN distribution.

Report information
The Basics
Id: 63384
Status: resolved
Priority: 0/
Queue: Mouse

Owner: Nobody in particular
Requestors: garu [...]

Bug Information
Severity: Important
Broken in: 0.87
Fixed in: (no value)

Subject: trigger is not compatible at all with (very old) Moose >= 0.73_01
Download (untitled) / with headers
text/plain 1.6k
Hi there! the "trigger" behavior changed a lot in Moose. In 0.73_01 we had: -------8<------- - Attribute triggers no longer receive the meta-attribute object as an argument in any circumstance. Previously, triggers called during instance construction were passed the meta-attribute, but triggers called by normal accessors were not. Fixes RT#44429, reported by Mark Swayne. (hdp) ------->8------- Then, in 0.89: -------8<------- - A trigger now receives the old value as a second argument, if the attribute had one. (Dave Rolsky) ------->8------- I don't think neither is implemented in Mouse at the moment. Mouse docs say: -------8<------- trigger => CodeRef Any time the attribute's value is set (either through the accessor or the constructor), the trigger is called on it. The trigger receives as arguments the instance, the new value, and the attribute instance. ------->8------- Since, according to Mouse::Spec, anything that has the same name as Moose is expected to be compatible, I'm think this is either a bug or something that need to be marked on the docs. To reproduce the problem is easy: -------8<------- package Foo; use Mouse; use Data::Dumper; has 'bar' => ( trigger => \&_foo ); sub _foo { warn Dumper(@_) } package main; my $foo = Foo->new( bar => 1 ); $foo->bar( 2 ); ------->8------- If you s/Mouse/Moose/ in the code above, you'll see 2 arguments printed by Data::Dumper on the first run, and 3 on the second run. With Mouse, it's always 2 arguments - which doesn't even comply with its own docs. I really enjoy Mouse and hope you guys can make it more awesome at every run. Hope this report helps to achieve that :) Thanks!
Download (untitled) / with headers
text/plain 275b
Hi, Thank you for the report. The behaviour of Mouse's trigger should be documented, but currently I don't plan to implement the same behaviour as Moose's because it seems useless. If you need the old values of attributes in triggers, please tell me that. Regards, -- gfx
This has been implemented in Mouse 1.07. -- Goro Fuji (gfx) GFUJI at

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to