NAME
Catmandu::Fix::cmd - pipe data to be fixed through an external process
VERSION
Version 0.0201
DESCRIPTION
This fix passes data as a JSON object to an external process over stdin and reads a JSON object from it's stdout.
SYNOPSIS
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);
}
SEE ALSO
AUTHOR
Nicolas Steenlant, <nicolas.steenlant at ugent.be>
LICENSE AND COPYRIGHT
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.