1MooseX::AttributeHelperUss:e:rTrCaointt:r:iCbMououtonestdeeXrP:(e:3rApltmt)DroicbuumteenHtealtpieorns::Trait::Counter(3pm)
2
3
4

NAME

6       MooseX::AttributeHelpers::Trait::Counter
7

VERSION

9       version 0.25
10

SYNOPSIS

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

DESCRIPTION

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

METHODS

45       meta
46       method_provider
47       has_method_provider
48       helper_type
49       process_options_for_provides
50           Run before its superclass method.
51
52       check_provides_values
53           Run after its superclass method.
54

PROVIDED METHODS

56       It is important to note that all those methods do in place modification
57       of the value stored in the attribute.
58
59       set Set the counter to the specified value.
60
61       inc Increments the value stored in this slot by 1. Providing an
62           argument will cause the counter to be increased by specified
63           amount.
64
65       dec Decrements the value stored in this slot by 1. Providing an
66           argument will cause the counter to be increased by specified
67           amount.
68
69       reset
70           Resets the value stored in this slot to it's default value.
71

SUPPORT

73       Bugs may be submitted through the RT bug tracker
74       <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-
75       AttributeHelpers> (or bug-MooseX-AttributeHelpers@rt.cpan.org
76       <mailto:bug-MooseX-AttributeHelpers@rt.cpan.org>).
77
78       There is also a mailing list available for users of this distribution,
79       at <http://lists.perl.org/list/moose.html>.
80
81       There is also an irc channel available for users of this distribution,
82       at "#moose" on "irc.perl.org" <irc://irc.perl.org/#moose>.
83

AUTHOR

85       Stevan Little <stevan@iinteractive.com>
86
88       This software is copyright (c) 2007 by Stevan Little and Infinity
89       Interactive, Inc.
90
91       This is free software; you can redistribute it and/or modify it under
92       the same terms as the Perl 5 programming language system itself.
93
94
95
96perl v5.30.0                     M2o0o1s9e-X0:7:-A2t6tributeHelpers::Trait::Counter(3pm)
Impressum