Skip Menu |

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: 61312
Status: rejected
Priority: 0/
Queue: Mouse

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

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



Applying roles after the fact changes the flow of method modifiers. It seems that application order takes precidance over the actual modifier type. #!/usr/bin/perl use strict; use warnings; use Test::Most qw{no_plan}; #----------------------------------------------------------------- BEGIN { package My::Test; use Mouse; has stack => ( is => 'rw', isa => 'ArrayRef', lazy => 1, default => sub{[]}, clearer => 'clear_stack', ); sub add { my $self = shift; push @{$self->stack}, 3 }; package My::Test::Around; use Mouse::Role; around add => sub{ my $next = shift; my $self = shift; push @{$self->stack}, 2 ; $self->$next(); }; package My::Test::Before; use Mouse::Role; before add => sub{ push @{ shift->stack }, 1 }; package My::Test::Whole; use Mouse; extends qw{My::Test}; with qw{My::Test::Before My::Test::Around}; }; #----------------------------------------------------------------- { my $T = My::Test::Whole->new; $T->add; eq_or_diff $T->stack, [1,2,3] } { my $T = My::Test->new ; $T->add ; eq_or_diff( $T->stack, [3] ); $T->clear_stack; My::Test::Before->meta->apply($T); $T->add; eq_or_diff( $T->stack, [1,3] ); $T->clear_stack; My::Test::Around->meta->apply($T); $T->add; eq_or_diff( $T->stack, [1,2,3] ); } __END__ ok 1 ok 2 ok 3 not ok 4 # Failed test at /tmp/mouse_method_modify.t line 68. # +----+-----+----+----------+ # | Elt|Got | Elt|Expected | # +----+-----+----+----------+ # * 0|2 * | | # | 1|1 | 0|1 | # | | * 1|2 * # | 2|3 | 2|3 | # +----+-----+----+----------+ 1..4 # Looks like you failed 1 test of 4. -- benh~
Hi, This is not a bug because Moose does so. If you really need that behaviour, please convince Moose team to do so. Thanks, -- gfx