Catman...::Mock(3pm)

πŸ“¦
version 1.2025 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– 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 an IO::Handle. if you don't specify it, Catmandu::Util::io gets called in to build the input stream for you, using either the file argument or STDIN. 🫢
  • encoding β€” this is the binmode of the input stream fh. it's set to :utf8 by 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