NAME

MouseX::AttributeHelpers::Counter

SYNOPSIS

  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);

DESCRIPTION

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

PROVIDERS

reset

set

inc

dec

METHODS

method_constructors

helper_type

helper_default

AUTHOR

NAKAGAWA Masaki <masaki@cpan.org>

LICENSE

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

SEE ALSO

MouseX::AttributeHelpers, MouseX::AttributeHelpers::Base