logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Catmandu::Fix::Inlineable - Role for all Catmandu fixes that can be inlined

Name

       Catmandu::Fix::Inlineable - Role for all Catmandu fixes that can be inlined

See Also

       For more information how to create fixes read the following two blog posts:

       http://librecat.org/catmandu/2014/03/14/create-a-fixer.htmlhttp://librecat.org/catmandu/2014/03/26/creating-a-fixer-2.html

perl v5.40.0                                       2025-01-17                     Catmandu::Fix::Inlineable(3pm)

Synopsis

           package Catmandu::Fix::my_fix1;

           use Catmandu::Sane;
           use Moo;

           with 'Catmandu::Fix::Inlineable';

           sub fix {
               my ($self, $data) = @_;
               ....FIXER GENERATING CODE....
               $data
           }

           package Catmandu::Fix::my_fix2;

           use Catmandu::Sane;
           use Moo;

           # Catmandu::Fix::Base automatically is Inlineable
           with 'Catmandu::Fix::Base';

           sub emit {
               my ($self, $fixer) = @_;
               ....FIXER GENERATING CODE....
           }

           package main;

           use Catmandu::Fix::my_fix1 as => 'my_fix1';
           # disabling caching may be desirable with fixes that have side effects like
           # writing to a file, the downside is that a new instance of the fix will be
           # created with each invocation
           use Catmandu::Fix::my_fix2 as => 'my_fix2', cache => 0;

           my $data = {};

           $data = my_fix1($data);
           $data = my_fix2($data);

See Also