Catman...::Mock(3pm)
π Catmandu::Importer::Mock(3pm) π
okay bestie, so this is a page from the Perl User Contributed Documentation, and the module in question is literally called Catmandu::Importer::Mock. It's the mock importer you use for testing purposes β no cap, that's its whole job. It's giving "stand-in bestie who shows up so you can rehearse the real thing" energy. π
β¨ NAME β¨
Catmandu::Importer::Mock β the mock importer used for testing purposes. That's it, that's the whole vibe. π¦
πΈ SYNOPSIS πΈ
lowkey just do this:
use Catmandu;
my $importer = Catmandu->importer('Mock');
my $n = $importer->each(sub {
my $hashref = $_[0];
# ...
});
like, you grab a Mock importer, then you each over it and every item lands in $hashref and you do your little thing. slay. π
π CONFIGURATION π
here's where you tell your importer how to behave. every single knob, no skipping:
fileβ reads input from a local file, and you give it the path. or β plot twist β you can pass a scalar reference and it'll read from a string instead. versatile queen. β¨fhβ reads input from anIO::Handle. if you don't specify it,Catmandu::Util::iogets called in to build the input stream for you, using either thefileargument orSTDIN. π«Άencodingβ this is the binmode of the input streamfh. it's set to:utf8by default, so like, it already knows. πfixβ an ARRAY of one or more fixes or file scripts that get applied to the imported items. stack 'em up. π₯sizeβ the number of items. and here's the tea: if you don't set it, you get an endless stream imported. forever. no brakes. π
π METHODS π
every Catmandu::Importer is a Catmandu::Iterable, and all its methods are inherited. so whatever the iterable can do, your mock importer can do too. it's literally nepotism but make it functional. π
π SEE ALSO π
Catmandu::Exporter::Null
and that's the whole page, bestie β a little gift from the User Contributed Perl Documentation crew, running on perl v5.40.1 and dated 2026-01-24. mwah π
π¦ where this page comes from
- ubuntu resolute: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms