| 1 | package Catmandu::Fix::Base; | ||
| 2 | |||
| 3 | 80 | ▶ | use Catmandu::Sane; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 80 | our $VERSION = '1.0201_02'; | |
| 6 | |||
| 7 | 80 | ▶ | use Catmandu::Fix; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 80 | ▶ | use Moo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 80 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 80 | with 'Catmandu::Fix::Inlineable', 'Catmandu::Logger'; | |
| 12 | |||
| 13 | 80 | requires 'emit'; | |
| 14 | |||
| 15 | 80 | has fixer => (is => 'lazy', init_arg => undef); | |
| 16 | |||
| 17 | sub _build_fixer { | ||
| 18 | 167 | ▶ | my ($self) = @_; |
|
Subroutine
_build_fixer: called CC=1 SCAR=0.0
| |||
| 19 | 167 | Catmandu::Fix->new(fixes => [$self]); | |
| 20 | } | ||
| 21 | |||
| 22 | sub fix { | ||
| 23 | 242 | ▶ | my ($self, $data) = @_; |
|
Subroutine
fix: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 24 | 242 | $self->fixer->fix($data); | |
| 25 | } | ||
| 26 | |||
| 27 | 80 | 1; | |
| 28 | |||
| 29 | __END__ | ||
| 30 | |||
| 31 | =pod | ||
| 32 | |||
| 33 | =head1 NAME | ||
| 34 | |||
| 35 | Catmandu::Fix::Base - Base class for all code emitting Catmandu fixes | ||
| 36 | |||
| 37 | =head1 SYNOPSIS | ||
| 38 | |||
| 39 | package Catmandu::Fix::my_fix; | ||
| 40 | |||
| 41 | use Catmandu::Sane; | ||
| 42 | use Moo; | ||
| 43 | |||
| 44 | with 'Catmandu::Fix::Base'; | ||
| 45 | |||
| 46 | sub emit { | ||
| 47 | my ($self, $fixer) = @_; | ||
| 48 | ....FIXER GENERATING CODE.... | ||
| 49 | } | ||
| 50 | |||
| 51 | =head1 SEE ALSO | ||
| 52 | |||
| 53 | For more information how to create fixes read the following two blog posts: | ||
| 54 | |||
| 55 | http://librecat.org/catmandu/2014/03/14/create-a-fixer.html | ||
| 56 | http://librecat.org/catmandu/2014/03/26/creating-a-fixer-2.html | ||
| 57 | =cut | ||