4 use Test::More tests => 8;
7 package MyRole::Delegator;
8 use MooseX::Role::Parameterized;
10 parameter handles => (
20 isa => 'MyClass::WithMethods',
21 handles => $p->handles,
27 package MyClass::WithMethods;
35 package MyArrayConsumer;
37 with 'MyRole::Delegator' => {
38 handles => ['foo', 'bar'],
42 can_ok(MyArrayConsumer => 'foo', 'bar');
43 cant_ok(MyArrayConsumer => 'baz');
46 package MyRegexConsumer;
48 with 'MyRole::Delegator' => {
53 can_ok(MyRegexConsumer => 'bar', 'baz');
54 cant_ok(MyRegexConsumer => 'foo');
57 package MyHashConsumer;
59 with 'MyRole::Delegator' => {
67 can_ok(MyHashConsumer => 'my_foo', 'his_baz');
68 cant_ok(MyHashConsumer => qw/foo bar baz/);
71 local $Test::Builder::Level = $Test::Builder::Level + 1;
74 ok(!$instance->can($method), "$instance cannot $method");