The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

Catmandu::Counter - A Base class for modules who need to count things

SYNOPSIS

package MyPackage;
use Moo;
sub calculate {
my ($self) = @_;
$self->inc_count;
#...do stuff
}
package main;
my $x = MyPackage->new;
$x->calculate;
$x->calculate;
$x->calculate;
print "Executed calculate %d times\n" , $x->count;

ATTRIBUTES

count

The current value of the counter.

METHODS

inc_count()

inc_count(NUMBER)

Increment the counter.

dec_count()

dec_count(NUMBER)

Decrement the counter.

reset_count()

Reset the counter to zero.

SEE ALSO

Catmandu::Exporter