Catman..._string(3pm)
๐ NAME ๐
Catmandu::Fix::import_from_string โ bestie, this one slurps data out of a string and drops it into an array ref, using an importer you name yourself. It's giving "glow up your string into actual data" energy. โจ
๐ธ SYNOPSIS ๐ธ
Okay so watch the glow-up happen in real time:
#BEFORE: { 'json' => '[{"name":"Nicolas"}]' }
#AFTER: { 'json' => [{"name":"Nicolas"}] }
import_from_string('json','JSON')
Look at that โ a string walked in and an array of hashes walked out. ๐
#BEFORE: { record => qq(first_name;name\nNicolas;Franck\nPatrick;Hochstenbach\n) }
#AFTER: { record => [{ "first_name" => "Nicolas",name => "Franck" },{ "first_name" => "Patrick",name => "Hochstenbach" }] }
import_from_string('record','CSV', 'sep_char' => ';')
And yes, you can pass extra options through, like 'sep_char' => ';' up there โ the importer gets them. ๐
๐ฆ DESCRIPTION ๐ฆ
โจ import_from_string( PATH, NAME [, IMPORT_OPTIONS ] ) โจ
This fix calls the function import_from_string from the package Catmandu, but plot twist: you have to hand it the NAME of the importer. It can't guess. It's not psychic, bestie. ๐ฎ
And here's the thing you can always count on: it always returns an array of hashes. No cap, no exceptions, just hashes in an array. Periodt. ๐
๐ PATH
(That's the one โ the path. That's it, that's the entry.) ๐
๐ NAME
This is the name of the importer to use. As usual in Catmandu, you've got options, and you can choose:
- the full package name of the importer (e.g.
'Catmandu::Importer::JSON') - the short package name of the importer (e.g.
'JSON') - the name of the importer as declared in the Catmandu configuration
Pick your fighter, they all slay. ๐ซถ
๐ IMPORT_OPTIONS
Extra options for the named importer โ pass whatever that importer needs, it's all vibes and parameters. โจ
๐ AUTHOR ๐
Nicolas Franck, "<nicolas.franck at ugent.be>" โ iconic, we love an author credit. ๐
๐ SEE ALSO ๐
Catmandu::FixCatmandu::Importer
Go read those next, bestie, they're the supporting cast. ๐ฆ
And that's the whole page, mwah ๐ โ this lil manual came to you courtesy of perl v5.40.1, dated 2026-01-24, filed under that Catman..._string(3pm) title up top (iykyk, the header got truncated, not my fault, I don't make the rules ๐ซ ). Stay hydrated, stay importing. ๐ธโจ
๐ฆ 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