Text::...Process(3pm)
β¨ Text::...Process(3pm) β¨
okay bestie, so this is the manual page for Text::MicroMason::PostProcess β the mixin that slaps filters on ALL your template output π it's giving "glow-up for your strings" and honestly? iconic.
πΈ NAME πΈ
Text::MicroMason::PostProcess β Apply Filters to All Template Output
like. it post-processes. it filters. it's the vibe check your output goes through before anyone sees it π¦
π SYNOPSIS π
bestie do NOT use this class directly, okay? the whole point is you pass its name so it gets mixed in:
use Text::MicroMason;
my $mason = Text::MicroMason->new( -PostProcess );
then you use the standard compile and execute methods to parse and evaluate templates like always:
print $mason->compile( text=>$template )->( @%args );
print $mason->execute( text=>$template, @args );
you can also define output filters when you create the thing, or later on, no biggie:
$mason = Text::MicroMason->new( -PostProcess, post_process => $func );
$mason->post_processors( $func );
$mason->compile( text => $template, post_process => $func );
$mason->execute( text => $template, { post_process => $func }, @args );
see? flexible. main character energy. β¨
π DESCRIPTION π
This mixin class adds filtering of all template output to any MicroMason class. yes, ALL of it. every last string. obsessed.
Filter functions can accept the string to be output and return a filtered version:
$mason->post_process( sub {
my $foo = shift;
$foo =~ s/a-Z/A-Z/;
return $foo;
} );
and lowkey here's the cute part β if a filter function has an empty prototype, it's assumed to work on $_:
$mason->post_process( sub () {
s/a-Z/A-Z/
} );
so tiny. so powerful. π«Ά
π Public Methods π
post_processors()β Gets and sets the functions to be used for output filtering.
Called with no arguments, returns the list of filter functions:
my @functions = $mason->post_processors();
Called with one array-ref argument, sets the list of filter functions:
$mason->post_processors( \@functions );
Called with one or more function-ref arguments, appends to the list:
$mason->post_processors( $filter1, $filter2 );
getter, setter, appender β she does it all fr fr π
π¦ Supported Attributes π¦
post_processβ Stores a reference to a function or an array of functions to be used:
$mason->{post_process} = $function;
$mason->{post_process} = [ $function1, $function2 ];
You can set this attribute when you create your mason object, or in calls to the compile and execute methods. whenever you want, bestie π
π§ Private Methods π§
post_process()
$mason->post_process( $output ) : $filtered_output
Applies the post-processing filter. that's the whole job. she's focused. she's efficient. periodt. π
β SEE ALSO β
- For an overview of this templating framework, see Text::MicroMason.
- This is a mixin class intended for use with Text::MicroMason::Base.
- For distribution, installation, support, copyright and license information, see Text::MicroMason::Docs::ReadMe.
no cap, if you're looking for the boring version of this page, it's not here β but every single fact is, so you're welcome π
that's a wrap, bestie!! this page was brought to you by perl v5.36.0 and dated 2023-08-10 β go forth and filter your output, you absolute legend πβ¨π
π¦ where this page comes from
- debian trixie: libtext-micromason-perl 2.23-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtext-micromason-perl 2.23-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtext-micromason-perl 2.23-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtext-micromason-perl 2.23-5 Β· 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