[libcatmandu-perl] 32/46: Adding pod for Catmandu::Counter

Jonas Smedegaard dr at jones.dk
Tue Oct 14 13:52:54 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.9205
in repository libcatmandu-perl.

commit 496f9edb330c281965148b6bc10cfb4ba9537e65
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date:   Fri Sep 26 13:50:03 2014 +0200

    Adding pod for Catmandu::Counter
---
 lib/Catmandu/Counter.pm | 57 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/lib/Catmandu/Counter.pm b/lib/Catmandu/Counter.pm
index 0ca67f7..b42a4a1 100644
--- a/lib/Catmandu/Counter.pm
+++ b/lib/Catmandu/Counter.pm
@@ -18,4 +18,61 @@ sub reset_count {
     my $self = $_[0]; $self->_set_count(0);
 }
 
+=head1 NAME
+
+Catmandu::Counter - A Base class for modules who need to count things
+
+=head1 SYNOPSIS
+
+    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;
+
+=head1 ATTRIBUTES
+
+=head2 count
+
+The current value of the counter.
+
+=head1 METHODS
+
+=head2 inc_count()
+
+=head2 inc_count(NUMBER)
+
+Increment the counter.
+
+=head2 dec_count()
+
+=head2 dec_count(NUMBER)
+
+Decrement the counter.
+
+=head2 reset_count()
+
+Reset the counter to zero.
+
+=head1 SEE ALSO
+
+L<Catmandu::Exporter>
+
+=cut
 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcatmandu-perl.git



More information about the Pkg-perl-cvs-commits mailing list