4 use Test::More tests => 6;
7 package MyItem::Role::Wearable;
8 use MooseX::Role::Parameterized;
10 parameter is_worn_default => (
21 default => $p->is_worn_default,
24 method equip => sub { shift->is_worn(1) };
25 method remove => sub { shift->is_worn(0) };
30 package MyItem::Role::Equippable;
31 use MooseX::Role::Parameterized;
39 # XXX: UGH! We need some way of making this work I think..
40 parameter is_worn_default => (
49 with 'MyItem::Role::Wearable' => {
50 is_worn_default => $p->is_worn_default,
53 method slot => sub { $p->slot };
58 package MyItem::Helmet;
60 with 'MyItem::Role::Equippable' => {
69 with 'MyItem::Role::Equippable' => {
75 can_ok('MyItem::Helmet', qw/is_worn equip remove slot/);
76 can_ok('MyItem::Belt', qw/is_worn equip remove slot/);
78 my $feathered = MyItem::Helmet->new;
79 ok(!$feathered->is_worn, "default for helmet is not worn");
80 is($feathered->slot, 'head');
82 my $chastity = MyItem::Belt->new;
83 ok($chastity->is_worn, "default for belt is worn");
84 is($chastity->slot, 'waist');