Catman...mporter(3pm)

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

πŸ’– NAME πŸ’–

Catmandu::Fix::Bind::importer β€” bestie, this is a binder, and what it does is run your fixes on records that come out of an importer. That's the whole vibe. πŸ¦‹

This page is the 3pm perl module manual for it, so like… it's documentation, but make it fashion. πŸ’…


✨ SYNOPSIS ✨

Okay so first thing, you can just run it:

#
catmandu run myfix.fix

And then inside your myfix.fix, it's giving:

# with myfix.fix
do importer(OAI,url: "http://lib.ugent.be/oai")
  retain(_id)
  add_to_exporter(.,YAML)
end

Or β€” hear me out β€” as a runnable Fix script, main character style:

# Or in an runnable Fix script:

#!/usr/bin/env catmandu run
add_field(hello,world)
add_to_exporter(.,YAML)

Or, alternatively, this way:

# Or:

#!/usr/bin/env catmandu run
do importer(OAI,url: "http://lib.ugent.be/oai")
  retain(_id)
  add_to_exporter(.,YAML)
end

🌸 DESCRIPTION 🌸

So the import binder literally computes all the Fix functions on records that get read from the importer you gave it. That's it. That's the job. 🫢

⚠️ no cap, read this twice: this importer doesn't change the current importer to the given one! Not a swap, not a takeover, none of that.

If you wanna control importers solely by the Fix script, use the catmandu run command line command. That's the one that handles it. πŸ‘‘


πŸŽ€ CONFIGURATION πŸŽ€

importer(IMPORTER_NAME, step: true|false, IMPORTER_ARGS...)

Loads the importer called IMPORTER_NAME into the current context. Simple. Iconic.

And here's the fun part: when step is 'true', then every single time you execute do importer() only one item gets read from the importer. One. Item. Per run. ✨

This is highkey handy when you've got nested iterators going on, like:

# This will produce:
#  {"n":0}
#  {"m":0}
#  {"n":1}
#  {"m":1}
#  {"n":2}
#  {"m":2}
# ...
do importer(Mock,size:20)
    move_field(n,brol)
    add_to_exporter(.,JSON)

    do importer(Mock,size:20,step:true)
        move_field(n,m)
        add_to_exporter(.,JSON)
    end
end

See how they interleave? n, m, n, m, n, m… obsessed. The inner one steps one at a time so the outer one can keep doing its thing. Nested iterator slay. πŸ’…πŸ”₯


πŸ¦‹ SEE ALSO πŸ¦‹

  • Catmandu::Fix::Bind
  • Catmandu::Cmd::run

okay that's the page, bestie β€” this was perl v5.40.1, dated 2026-01-24, and it's the Catman...mporter(3pm) manual, user contributed Perl documentation and all πŸ’œ go read Catmandu::Fix::Bind next, ily, bye πŸŽ€βœ¨

πŸ“¦ where this page comes from