Commit | Line | Data |
---|---|---|
4aaa2ed6 | 1 | use strict; |
2 | use warnings; | |
6cfa1e5e | 3 | use Test::More tests => 6; |
4aaa2ed6 | 4 | |
5 | { | |
6 | package Animal; | |
7 | use Mouse::Role; | |
8 | sub eat { 'delicious' } | |
9 | } | |
10 | ||
11 | { | |
12 | package Cat; | |
13 | use Mouse::Role; | |
14 | with 'Animal', { | |
6cfa1e5e | 15 | -alias => { eat => 'drink' }, |
16 | -excludes => [qw(eat)], | |
4aaa2ed6 | 17 | }; |
18 | sub eat { 'good!' } | |
19 | } | |
20 | ||
21 | { | |
22 | package Tama; | |
23 | use Mouse; | |
24 | with 'Cat'; | |
25 | } | |
26 | ||
27 | { | |
28 | package Dog; | |
29 | use Mouse; | |
30 | with 'Animal', { | |
6cfa1e5e | 31 | -alias => { eat => 'drink' }, |
4aaa2ed6 | 32 | }; |
33 | } | |
34 | ||
21498b08 | 35 | ok(Dog->can('eat')); |
4aaa2ed6 | 36 | ok(Dog->can('drink')); |
37 | ||
38 | my $d = Dog->new(); | |
39 | is($d->drink(), 'delicious'); | |
6cfa1e5e | 40 | is($d->eat(), 'delicious'); |
4aaa2ed6 | 41 | |
42 | my $t = Tama->new; | |
43 | is $t->drink(), 'delicious'; | |
44 | is $t->eat(), 'good!'; | |
45 |