Catman...etValue(3pm)
π Catmandu::Fix::SimpleGetValue π
okay so bestie, welcome to the Catman...etValue(3pm) page β it lives in the User Contributed Perl Documentation section and it is genuinely the blueprint for making your own emit Fixes. slay.
β¨ NAME β¨
Catmandu::Fix::SimpleGetValue β a helper class for creating emit Fix-es. no cap, that's the whole job description π«Ά
πΈ SYNOPSIS πΈ
here's the glow-up moment β building a whole Rot13 encrypter:
# Create a Rot13 encrypter
package Catmandu::Fix::rot13;
use Catmandu::Sane;
use Moo;
use Catmandu::Fix::Has;
has path => (fix_arg => 1);
with 'Catmandu::Fix::SimpleGetValue';
sub emit_value {
my ($self, $var, $fixer) = @_;
"${var} =~ y/A-Za-z/N-ZA-Mn-za-m/ if is_string(${var});";
}
# Now you can use this Fix in your scripts
rot13(my.deep.nested.path)
rot13(authors.*)
and then you justβ¦ use it. in your scripts. like it's nothing. iconic behaviour honestly π
π¦ DESCRIPTION π¦
okay so Catmandu::Fix::SimpleGetValue exists purely to make life easier when you're creating emit Fixes that transform values on a JSON path. that's it. that's the vibe. β¨
any Fix package that implements Catmandu::Fix::SimpleGetValue has to implement a method called emit_value. that method takes:
- the variable name the Fix operates on
- an instance of
Catmandu::Fix
and it should return a string containing the Perl code that transforms values on a JSON path.
π«Ά lowkey important caveat: in an emit Fix you can't inspect the actual value the Fix runs on.$varholds a variable name, not the actual value. the real values only show up at run time. emit Fixes are the mechanism that compiles Perl code into Fix modules, and those modules are what actually do the transformation. so yeah,$varis giving placeholder energy, not value energy. π
want more examples? go read the source code of these absolute legends:
Catmandu::Fix::append;Catmandu::Fix::replace_allCatmandu::Fix::upcase
π SEE ALSO π
Catmandu::Fix
and that's the whole page, bestie π go forth and write emit Fixes. stay hydrated, keep your $var sussy, and remember β this page was brought to you by perl v5.40.1, dated 2026-01-24. mwah ππ§πΈ
π¦ 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