isa => 'Int',
default => sub { 0 },
provides => {
- inc => 'inc_counter',
- dec => 'dec_counter',
+ inc => 'inc_counter',
+ dec => 'dec_counter',
+ reset => 'reset_counter',
}
);
}
can_ok($page, $_) for qw[
dec_counter
inc_counter
+ reset_counter
];
is($page->counter, 0, '... got the default value');
$page->dec_counter;
is($page->counter, 1, '... got the decremented value');
+$page->reset_counter;
+is($page->counter, 0, '... got the original value');
+
# check the meta ..
my $counter = $page->meta->get_attribute('counter');
is($counter->type_constraint->name, 'Int', '... got the expected type constraint');
is_deeply($counter->provides, {
- inc => 'inc_counter',
- dec => 'dec_counter',
+ inc => 'inc_counter',
+ dec => 'dec_counter',
+ reset => 'reset_counter',
}, '... got the right provides methods');