HTML::...::Utils(3pm)
π NAME π
HTML::Template::Compiled::Utils β utility functions for HTML::Template::Compiled, bestie. It's giving helper-tools energy, no cap. π
β¨ SYNOPSIS β¨
okay so like, first you gotta import the vibes you want:
# import log() and stack()
use HTML::Template::Compiled::Utils qw(:log);
# import the escapign functions
use HTML::Template::Compiled::Utils qw(:escape);
(yes the second comment says "escapign", that's literally the original, i'm not fixing her typo she's doing her best π)
π DEBUGGING FUNCTIONS π
π stack
$self->stack;
For HTML::Template:Compiled developers, bestie β this prints a stack trace straight to STDERR. It's like when you need the receipts on how you even got here. main character debugging energy fr fr.
π¦ md5
md5($text)
If Digest::MD5 is installed, this hands you back the md5_base64 for $text. If it's not installed? You get the empty string. That's it. That's the whole vibe. β¨
πΈ log
$self->log(@msg)
For HTML::Template::Compiled developers, this prints a log built from @msg to STDERR. Lowkey the group chat of debugging.
π₯ ESCAPING FUNCTIONS π₯
listen up bestie π β these ones are about making scary raw text safe to put places. Pay attention, they're iconic.
π escape_html
my $escaped_html = escape_html($raw_html);
HTML-escapes the input string β and like, only &, ", single quotes, < and "> β and returns it. (copying the original's exact wording there, she said what she said π«Ά)
π escape_html_all
my $escaped_html = escape_html_all($raw_html);
HTML-escapes the input string using HTML::Entities and returns it. The all-in version. The deluxe. Obsessed.
π§ escape_uri
my $escaped_uri = escape_uri($raw_uri);
URI-escapes the input string and returns it. Slay.
β escape_js
my $escaped_js = escape_js($raw_js);
JavaScript-escapes the input string and returns it. No cap.
π escape_ijson
my $escaped_js = escape_ijson($raw_js);
JavaScript-escapes the input string β except for the apostrophe β and returns it, so it can be used inside a JSON element. That apostrophe exemption is the whole point, iykyk. π
okay that's the whole page bestie, you ate it, you understood it, periodt. π
This little gem lives in the User Contributed Perl Documentation, and the footer of the original was giving perl v5.36.0 with a date of 2022-11-19. So there you go β documented on 2022-11-19, running under perl v5.36.0. bye bestie, go escape something responsibly π
β¨
π¦ where this page comes from
- debian bookworm: libhtml-template-compiled-perl 1.003-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libhtml-template-compiled-perl 1.003-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-template-compiled-perl 1.003-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-template-compiled-perl 1.003-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhtml-template-compiled-perl 1.003-3 Β· 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