package Catmandu::Fix::cmd;
use namespace::clean;
use Catmandu::Sane;
use IO::Pty::Easy;
use JSON::XS;
use Moo;
=head1 NAME
Catmandu::Fix::cmd - pipe data to be fixed through an external process
=
$VERSION = '0.0201';
=head1 DESCRIPTION
This fix passes data as a JSON object to an external process over stdin and
reads a JSON object from it's stdout.
=head1 SYNOPSIS
my $fixer = Catmandu:
jq command-line json processor
# keeping only the title field
'cmd("jq -c -M {title}")',
# ...
]);
# a canonical external program in perl
use JSON;
while (<ST