[libcatmandu-perl] 22/46: Adding pod

Jonas Smedegaard dr at jones.dk
Tue Oct 14 13:52:53 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 c2090327eb46b3c83a38fef9445ed5786f786034
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date:   Mon Sep 22 16:17:32 2014 +0200

    Adding pod
---
 lib/Catmandu/Iterator.pm | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/lib/Catmandu/Iterator.pm b/lib/Catmandu/Iterator.pm
index dea1b89..a9e51d4 100644
--- a/lib/Catmandu/Iterator.pm
+++ b/lib/Catmandu/Iterator.pm
@@ -14,4 +14,53 @@ sub generator {
     goto &{$_[0]};
 }
 
+=head1 NAME
+
+Catmandu::Iterator - Base class for all Catmandu iterators
+
+=head1 SYNOPSIS
+
+  package My::MockIterator;
+
+  use Moo;
+  
+  with 'Catmandu::Iterable';
+
+  sub generator {
+    sub {
+        # Generator some random data
+        +{ random => rand };
+   	}
+  } 
+
+  package main;
+ 
+  my $it = My::MockIterator->new;
+
+  my first = $it->first;
+
+  $it->each(sub {
+	my $item = shift;
+
+	print $item->{random} , "\n";
+  });
+
+  my $it2 = $it->map(sub { shift->{random} * 2 });
+
+=head1 METHOD
+
+=head2 generator
+
+Should return a closure that generates one Perl hash.
+
+=head1 INHERIT
+
+If you provide a generator, then the class will generator all methods from L<Catmandu::Iterable>.
+
+=head1 SEE ALSO
+
+L<Catmandu::Iterable>
+
+=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