Templa...Filter(3pm)

πŸ“¦
version 0.143050 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Templa...Filter(3pm) πŸ’–

okay bestie, you found the perl manual page for Template::AutoFilter (yes that truncated Templa...Filter is just how the header looks when it's being dramatic, don't worry about it) πŸŽ€


✨ NAME ✨

Template::AutoFilter β€” Template::Toolkit but it filters stuff for you automatically, no cap πŸ’…

🌸 VERSION 🌸

version 0.143050

πŸ¦‹ SYNOPSIS πŸ¦‹

use Template::AutoFilter;

my $templ = "[% str %]  [% str | none %]  [% str | url %]";

my $out;
Template::AutoFilter->new->process( \$templ, { str => '<a>' }, \$out );

print $out; # "&lt;a&gt;  <a>  %3Ca%3E"

my $out;
Template::AutoFilter->new( AUTO_FILTER => 'upper' )->process( \$templ, { str => '<a>' }, \$out );

print $out; # "<A>  <a>  %3Ca%3E"

like look at that. str comes out escaped by default, | none says "leave me alone", and | url does its url thing. slay ✨

πŸ‘‘ DESCRIPTION πŸ‘‘

Template::AutoFilter is a subclass of Template::Toolkit, and the way it works is it loads a very specific Parser that is itself subclassed from Template::Parser. What that parser does: it adds a filter instruction to every single interpolation token it finds in templates loaded by the TT engine. Tokens that already have a filter instruction? Untouched. left exactly as they are. iconic behavior honestly πŸ™ˆ

By default this automatic filter is set to 'html', but you can change it during object creation by passing the AUTO_FILTER option with the name of the filter you actually want. your template, your rules πŸ’…

Also β€” and this is the cute part β€” a pass-through filter called 'none' gets added to the object, so you can exclude specific tokens from being filtered. if a token doesn't want the treatment, it doesn't have to get the treatment 🫢

Lastly, if you're having problems with the directives which get auto filters applied, you can go read the Template::AutoFilter::Parser docs to see how you can customize that. go check it out, it's giving solutions ✨

⚠️ WARNING: This module is highly experimental. The author has not done a lot of testing and things might blow up in unexpected ways. πŸ’€ The API and behavior might change with any release (until 1.0). If you'd like to see any changes implemented, let them know via RT, email, IRC, or by opening a pull request on github.
πŸ”₯ Use at your own risk.

πŸ’œ METHODS πŸ’œ

🌈 new

Pre-processes the parameters passed on to Template's new(). Adds the pass-through filter and creates the AutoFilter Parser. it's doing a little setup choreography for you, bestie 🧚

All parameters passed to this new() will also be passed to the parser's new(). everything gets forwarded, no secrets 🌸


πŸŽ€ CONTRIBUTORS πŸŽ€

  • Ryan Olson (cpan:GIMPSON) <ryan@ziprecruiter.com>
  • Aran Deltac (cpan:BLUEFEET) <aran@ziprecruiter.com>
  • Thomas Sibley (cpan:TSIBLEY) <tsibley@cpan.org>

the squad πŸ’–

⭐ SUPPORT ⭐

πŸ“ Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker at <http://rt.cpan.org/Public/Dist/Display.html?Name=Template-AutoFilter>. You will be notified automatically of any progress on your issue. so you'll always know what's happening, periodt πŸ‘‘

🌈 Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

<https://github.com/wchristian/Template-AutoFilter>

git clone https://github.com/wchristian/Template-AutoFilter.git

go clone it, it's right there, main character energy πŸ¦‹

πŸ’… AUTHOR πŸ’…

Christian Walde <walde.christian@gmail.com>

Christian Walde has dedicated the work to the Commons by waiving all of his or her rights to the work worldwide under copyright law and all related or neighboring legal rights he or she had in the work, to the extent allowable by law.

Works under CC0 do not require attribution. When citing the work, you should not imply endorsement by the author.


and that's the whole page, bestie 🫢 this was perl v5.36.0, dated 2022-11-19, and yes the footer says Templa...Filter(3pm) again because the header and footer are matching, as they should πŸ’–βœ¨