
MouseX::AttributeHelpers::Counter

package MyHomePage;
use Mouse;
use MouseX::AttributeHelpers;
has 'counter' => (
metaclass => 'Counter',
is => 'rw',
isa => 'Num',
default => 0,
provides => {
inc => 'inc_counter',
dec => 'dec_counter',
reset => 'reset_counter',
},
);
package main;
my $page = MyHomePage->new;
$page->inc_counter; # same as $page->counter($page->counter + 1);
$page->dec_counter; # same as $page->counter($page->counter - 1);

This module provides a simple counter attribute, which can be incremented and decremented.



NAKAGAWA Masaki <masaki@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
