3
use MooseX::MethodAttributes ();
5
use Test::More tests => 2;
7
# This tests the 'old' form of using MooseX::MethodAttributes with -traits => 'MethodAttributes'
8
# The new (and nicer) way is to just say use MooseX::MethodAttributes::Role
12
use Moose::Role -traits => 'MethodAttributes';
13
use namespace::clean -except => 'meta';
15
sub item :Chained(/app/root) PathPrefix CaptureArgs(1) { }
20
use Moose::Role -traits => 'MethodAttributes';
21
use namespace::clean -except => 'meta';
23
sub live :Chained(item) PathPart Args(0) { }
29
package Catalyst::Controller;
31
use namespace::clean -except => 'meta';
33
BEGIN { extends qw/MooseX::MethodAttributes::Inheritable/; }
37
use Moose::Meta::Class;;
39
Moose::Meta::Class->create("MyClass",
40
superclasses => [qw/Catalyst::Controller/],
41
roles => ["Bar", "Foo"],
45
ok MyClass->meta->can('get_all_methods_with_attributes')
46
or skip 'Role combination and method attributes known broken', 1;
49
for my $method (sort { $a->name cmp $b->name } MyClass->meta->get_all_methods_with_attributes) {
50
push(@methods, $method->name . " :" . join("|", @{ $method->attributes }));
53
is_deeply \@methods, [
55
'item :Chained(/app/root)|PathPrefix|CaptureArgs(1)',
56
'live :Chained(item)|PathPart|Args(0)',
58
], 'methods with expected attributes found';
3
use MooseX::MethodAttributes ();
5
use Test::More tests => 2;
7
# This tests the 'old' form of using MooseX::MethodAttributes with -traits => 'MethodAttributes'
8
# The new (and nicer) way is to just say use MooseX::MethodAttributes::Role
12
use Moose::Role -traits => 'MethodAttributes';
13
use namespace::clean -except => 'meta';
15
sub item :Chained(/app/root) PathPrefix CaptureArgs(1) { }
20
use Moose::Role -traits => 'MethodAttributes';
21
use namespace::clean -except => 'meta';
23
sub live :Chained(item) PathPart Args(0) { }
29
package Catalyst::Controller;
31
use namespace::clean -except => 'meta';
33
BEGIN { extends qw/MooseX::MethodAttributes::Inheritable/; }
37
use Moose::Meta::Class;;
39
Moose::Meta::Class->create("MyClass",
40
superclasses => [qw/Catalyst::Controller/],
41
roles => ["Bar", "Foo"],
45
ok MyClass->meta->can('get_all_methods_with_attributes')
46
or skip 'Role combination and method attributes known broken', 1;
49
for my $method (sort { $a->name cmp $b->name } MyClass->meta->get_all_methods_with_attributes) {
50
push(@methods, $method->name . " :" . join("|", @{ $method->attributes }));
53
is_deeply \@methods, [
55
'item :Chained(/app/root)|PathPrefix|CaptureArgs(1)',
56
'live :Chained(item)|PathPart|Args(0)',
58
], 'methods with expected attributes found';