Catmandu::Iterator(3pm)

Catmandu::Iterator3pm

Base class for all catmandu iterators

Usage

  package My::MockIterator;
  use Catmandu;
  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 });

Methods

generator

Should return a closure that generates one Perl hash.

Inherit

If you provide a generator, then the class will generator all methods from Catmandu::Iterable.

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.