1MooseX::AttributeHelperUss:e:rCoCuonntterri(b3u)ted PerlMoDoosceuXm:e:nAttattriiobnuteHelpers::Counter(3)
2
3
4

NAME

6       MooseX::AttributeHelpers::Counter
7

SYNOPSIS

9         package MyHomePage;
10         use Moose;
11         use MooseX::AttributeHelpers;
12
13         has 'counter' => (
14             metaclass => 'Counter',
15             is        => 'ro',
16             isa       => 'Num',
17             default   => sub { 0 },
18             provides  => {
19                 inc => 'inc_counter',
20                 dec => 'dec_counter',
21                 reset => 'reset_counter',
22             }
23         );
24
25         my $page = MyHomePage->new();
26         $page->inc_counter; # same as $page->counter($page->counter + 1);
27         $page->dec_counter; # same as $page->counter($page->counter - 1);
28

DESCRIPTION

30       This module provides a simple counter attribute, which can be incre‐
31       mented and decremeneted.
32
33       If your attribute definition does not include any of is, isa, default
34       or provides but does use the "Counter" metaclass, then this module
35       applies defaults as in the "SYNOPSIS" above. This allows for a very
36       basic counter definition:
37
38         has 'foo' => (metaclass => 'Counter');
39         $obj->inc_foo;
40

METHODS

42       meta
43       method_provider
44       has_method_provider
45       helper_type
46       process_options_for_provides
47           Run before its superclass method.
48
49       check_provides_values
50           Run after its superclass method.
51

PROVIDED METHODS

53       It is important to note that all those methods do in place modification
54       of the value stored in the attribute.
55
56       inc Increments the value stored in this slot by 1.
57
58       dec Decrements the value stored in this slot by 1.
59
60       reset
61           Resets the value stored in this slot to it's default value.
62

BUGS

64       All complex software has bugs lurking in it, and this module is no
65       exception. If you find a bug please either email me, or add the bug to
66       cpan-RT.
67

AUTHOR

69       Stevan Little <stevan@iinteractive.com>
70
72       Copyright 2007 by Infinity Interactive, Inc.
73
74       <http://www.iinteractive.com>
75
76       This library is free software; you can redistribute it and/or modify it
77       under the same terms as Perl itself.
78
79
80
81perl v5.8.8                       2008-01-0M6ooseX::AttributeHelpers::Counter(3)
Impressum