1Moose::Meta::Attribute:U:sNeartiCvoenM:to:roTisrbeau:it:teM:de:tCPaoe:ur:nlAtteDtror(ci3ub)muetnet:a:tNiaotnive::Trait::Counter(3)
2
3
4

NAME

6       Moose::Meta::Attribute::Native::Trait::Counter - Helper trait for
7       counters
8

SYNOPSIS

10         package MyHomePage;
11         use Moose;
12
13         has 'counter' => (
14             traits    => ['Counter'],
15             is        => 'ro',
16             isa       => 'Num',
17             default   => 0,
18             handles   => {
19                 inc_counter   => 'inc',
20                 dec_counter   => 'dec',
21                 reset_counter => 'reset',
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
29         my $count_by_twos = 2;
30         $page->inc_counter($count_by_twos);
31

DESCRIPTION

33       This module provides a simple counter attribute, which can be
34       incremented and decremented by arbitrary amounts.  The default amount
35       of change is one.
36

PROVIDED METHODS

38       These methods are implemented in
39       Moose::Meta::Attribute::Native::MethodProvider::Counter. It is
40       important to note that all those methods do in place modification of
41       the value stored in the attribute.
42
43       set($value)
44           Set the counter to the specified value.
45
46       inc($arg)
47           Increase the attribute value by the amount of the argument.  No
48           argument increments the value by 1.
49
50       dec($arg)
51           Decrease the attribute value by the amount of the argument.  No
52           argument decrements the value by 1.
53
54       reset
55           Resets the value stored in this slot to it's default value.
56

METHODS

58       meta
59       method_provider
60       has_method_provider
61

BUGS

63       See "BUGS" in Moose for details on reporting bugs.
64

AUTHOR

66       Stevan Little <stevan@iinteractive.com>
67
69       Copyright 2007-2009 by Infinity Interactive, Inc.
70
71       <http://www.iinteractive.com>
72
73       This library is free software; you can redistribute it and/or modify it
74       under the same terms as Perl itself.
75
76
77
78perl v5.12.2                 Moose2:0:1M0e-t0a8:-:2A8ttribute::Native::Trait::Counter(3)
Impressum