1Data::Perl::Role::CountUesre(r3)Contributed Perl DocumenDtaattai:o:nPerl::Role::Counter(3)
2
3
4
6 Data::Perl::Role::Counter - Wrapping class for a simple numeric
7 counter.
8
10 version 0.002011
11
13 use Data::Perl qw/counter/;
14
15 my $c = counter(4);
16
17 $c->inc; # $c == 5
18
19 $c->reset; # $c == 0
20
22 This class provides a wrapper and methods for a simple numeric counter.
23
25 new($value)
26 Constructs a new Data::Perl::Collection::Counter object initialized
27 with the passed in value, and returns it.
28
29 set($value)
30 Sets the counter to the specified value and returns the new value.
31
32 This method requires a single argument.
33
34 inc
35 inc($arg)
36 Increases the attribute value by the amount of the argument, or by
37 1 if no argument is given. This method returns the new value.
38
39 This method accepts a single argument.
40
41 dec
42 dec($arg)
43 Decreases the attribute value by the amount of the argument, or by
44 1 if no argument is given. This method returns the new value.
45
46 This method accepts a single argument.
47
48 reset
49 Resets the value stored in this slot to its default value, and
50 returns the new value.
51
53 • Data::Perl
54
55 • MooX::HandlesVia
56
58 Matthew Phillips <mattp@cpan.org>
59
61 This software is copyright (c) 2020 by Matthew Phillips
62 <mattp@cpan.org>.
63
64 This is free software; you can redistribute it and/or modify it under
65 the same terms as the Perl 5 programming language system itself.
66
67
68
69perl v5.34.0 2021-07-22 Data::Perl::Role::Counter(3)