DOKK / manpages / debian 12 / libcatmandu-fix-cmd-perl / Catmandu::Fix::cmd.3pm.en
Catmandu::Fix::cmd(3pm) User Contributed Perl Documentation Catmandu::Fix::cmd(3pm)

Catmandu::Fix::cmd - pipe data to be fixed through an external process

Version 0.0201

This fix passes data as a JSON object to an external process over stdin and reads a JSON object from it's stdout.

    my $fixer = Catmandu::Fix->new(fixes => [
        # pipe data through the jq command-line json processor
        # keeping only the title field
        'cmd("jq -c -M {title}")', 
        # ...
    ]);
    # a canonical external program in perl
    use JSON;
    while (<STDIN>) {
        my $data = decode_json($_);
        # ...
        print encode_json($data);
    }

Catmandu::Fix

Nicolas Steenlant, "<nicolas.steenlant at ugent.be>"

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

2023-02-04 perl v5.36.0