Skip to content
Patrick Hochstenbach edited this page Jun 3, 2014 · 9 revisions

For an extended introduction into creating Fix packages read the two blog posts at:

Create a Fix (short version)

The easiest way to create a new 'Fix' is by creating a Perl package in the Catmandu::Fix namespace that has a 'fix' instance method. For example:

package Catmandu::Fix::foo;

use Moo;

sub fix {
    my ($self,$data) = @_;

    # Fix your data here...

    $data;
}

1;

When this code is installed in your PERL5LIB path as Catmandu/Fix/foo.pm then you fix scripts can execute this fix by running:

foo()

Or, from the command line:

$ catmandu convert JSON --fix "foo()" < data.json
Clone this wiki locally