![]() |
![]()
| ![]() |
![]()
NAMEMouseX::AttributeHelpers::Counter SYNOPSISpackage 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); DESCRIPTIONThis module provides a simple counter attribute, which can be incremented and decremented. PROVIDERSresetsetincdecMETHODSmethod_constructorshelper_typehelper_defaultAUTHORNAKAGAWA Masaki <masaki@cpan.org> LICENSEThis library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSOMouseX::AttributeHelpers, MouseX::AttributeHelpers::Base
|