Skip Menu |

This queue is for tickets about the MooseX-MethodAttributes CPAN distribution.

Report information
The Basics
Id: 48758
Status: resolved
Priority: 0/
Queue: MooseX-MethodAttributes

People
Owner: Nobody in particular
Requestors: rs [...] 474.at
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.15
Fixed in: (no value)



Subject: MooseX::MethodAttributes::Role::Meta::Role->apply does not pass %opts on to parent
The MooseX::MethodAttributes::Role::Meta::Role role adds an around modifier to the apply method, and later calls $self->$orig($thing). However, it does not pass the options in %opt to the next apply method. This is required for compatibility with e.g. MooseX::Role::Parameterized.
Subject: Re: [rt.cpan.org #48758] MooseX::MethodAttributes::Role::Meta::Role->apply does not pass %opts on to parent
Date: Sun, 16 Aug 2009 22:38:13 +0100
To: bug-MooseX-MethodAttributes [...] rt.cpan.org
From: Tomas Doran <bobtfish [...] bobtfish.net>
On 16 Aug 2009, at 21:07, Robert 'phaylon' Sedlacek via RT wrote: Show quoted text
> The MooseX::MethodAttributes::Role::Meta::Role role adds an around > modifier to the apply method, and later calls $self->$orig($thing). > However, it does not pass the options in %opt to the next apply > method. > This is required for compatibility with e.g. > MooseX::Role::Parameterized.
Yes, in fact, it should explicitly explode if you pass %opts - as aliasing / exclusion for 'normal' roles doesn't work either. I _will_ be fixing this when I start using rafl's new Moose stuff allowing role combination to work. Please supply tests for compatibility with MooseX::Role::Parameterized? Cheers t0m
I attached a testfile. If you want to put it into the public test suite, it'll need an additional skip_all if MX:R:P is not installed. The test passes with %opts passed to the parent, and fails in the current version for me. HTH, phaylon
use strict; use warnings; use Test::More; package Foo; use MooseX::Role::Parameterized -traits => 'MooseX::MethodAttributes::Role::Meta::Role'; parameter foo => ( isa => "Str", ); role { my $p = shift; method test_foo => sub { my ($self, $should_be) = @_; package main; is $p->foo, $should_be, 'parameter is correct'; }; }; package UseFoo; use Moose; with Foo => { foo => 23 }; package main; UseFoo->new->test_foo(23); done_testing;
This is now in master with fixes, and also in the new role_combination2 branch for fixing that. I hope to have that finished and released in a weeks time (max, given new Moose comes out by then) - yell if you'd like a release before that just for this. Many thanks for the bug report and test case. Cheers t0m