Catman...ineable(3pm)
β¨ Catmandu::Fix::Inlineable β¨
okay bestie so real quick β this is the role for all the Catmandu fixes that can be inlined. that's it. that's the whole vibe. it's giving "behind the scenes glue that makes your fixes fast" and honestly? iconic. π
πΈ SYNOPSIS πΈ
no cap, here's how it goes:
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);
so like, two ways to be a fix baddie here π
- one: roll your own with
with 'Catmandu::Fix::Inlineable';and write afixsub that takes($self, $data)and hands$databack at the end β<pink>....FIXER GENERATING CODE....</pink>goes in the middle, that's your moment, that's your main character arc. - two: pull in
with 'Catmandu::Fix::Base';instead, because Catmandu::Fix::Base automatically is Inlineable β no extra steps, it just comes pre-loaded with the vibe. with that one you write anemitsub taking($self, $fixer)instead. π¦
then in package main you load them as actual usable fixes:
use Catmandu::Fix::my_fix1 as => 'my_fix1';
use Catmandu::Fix::my_fix2 as => 'my_fix2', cache => 0;
heads up bestie β turning off caching with cache => 0 may be desirable with fixes that have side effects, like writing to a file. the trade-off? the downside is that a new instance of the fix will be created with each invocation. so likeβ¦ pick your fighter. π
and then you literally just call them on your data:
my $data = {};
$data = my_fix1($data);
$data = my_fix2($data);
clean. simple. ate. π
π SEE ALSO π
want the full lore on how to create fixes? go read these two blog posts, they're the blueprint, fr fr:
http://librecat.org/catmandu/2014/03/14/create-a-fixer.html
http://librecat.org/catmandu/2014/03/26/creating-a-fixer-2.html
and that's the whole page, bestie π this lil gem is part of the User Contributed Perl Documentation situation, and it's chillin' at perl v5.40.1, dated 2026-01-24 β yes, from the future, no we will not be explaining that πβ go forth and inline, you've got this π«Άπ
π¦ where this page comes from
- ubuntu resolute: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms