Catmandu::Fix::import_from_string(3pm)

Catmandu::Fix::import_from_string3pm

Import data from a string into an array ref, using a named importer.

Usage

    #BEFORE: { 'json' => '[{"name":"Nicolas"}]' }
    #AFTER:  { 'json' => [{"name":"Nicolas"}] }
    import_from_string('json','JSON')
    #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' => ';')

Overview

import_from_string( PATH, NAME [, IMPORT_OPTIONS ] )

This fix uses the function import_from_string of the package Catmandu, but requires the NAME of the importer.

It always returns an array of hashes.

PATH
NAME

name of the importer to use. As usual in Catmandu, one can choose:

* full package name of the importer (e.g. 'Catmandu::Importer::JSON')

* short package name of the importer (e.g. 'JSON')

* name of the importer as declared in the Catmandu configuration

IMPORT_OPTIONS

extra options for the named importer

Releases

4 releases since Debian 10 (Buster); the text changed 3 times.

  1. 10
  2. 11
  3. 12
  4. 13

Author

Nicolas Franck, "<nicolas.franck at ugent.be>"

From libcatmandu-perl 1.2024-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.