/usr/share/perl5/Catmandu/Importer/Mock.pm is in libcatmandu-perl 0.9206-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | package Catmandu::Importer::Mock;
use namespace::clean;
use Catmandu::Sane;
use Moo;
with 'Catmandu::Importer';
has size => (is => 'ro');
sub generator {
my ($self) = @_;
my $n = 0;
sub {
return if defined $self->size && $n == $self->size;
return { n => $n++ };
};
}
=head1 NAME
Catmandu::Importer::Mock - Mock importer used for testing purposes
=head1 SYNOPSIS
use Catmandu::Importer::Mock;
my $importer = Catmandu::Importer::Mock->new();
my $n = $importer->each(sub {
my $hashref = $_[0];
# ...
});
=head1 METHODS
=head2 new(size => $n, fix => [...])
Create a new Mock importer. Optionally provide a size parameter.
The constructor inherits the fix parameter from L<Catmandu::Fixable>. When given,
then each fix or fix script will be applied to imported items.
=head2 count
=head2 each(&callback)
=head2 ...
Every L<Catmandu::Importer> is a L<Catmandu::Iterable> all its methods are
inherited.
=head1 SEE ALSO
L<Catmandu::Iterable>
=cut
1;
|