Catmandu::Counter(3pm)

Catmandu::Counter3pm

A base class for modules who need to count things

Usage

    package MyPackage;
    use Moo;
    with 'Catmandu::Counter';
    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.

Releases

6 releases since Debian 8 (Jessie); the text changed 5 times.

  1. 8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13

From libcatmandu-perl 1.2024-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.