Templa...ceUTF8(3pm)

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

πŸ’– Template::Stash::ForceUTF8 β€” the 3pm girlie who forces the flag πŸ’–

okay so bestie, this one lives in the Perl User Contributed docs corner of the manual, page name Templa...ceUTF8 (yes the title's been snipped, it's giving mystery, iykyk) and the manual section is 3pm. Let's get into it ✨


✨ NAME ✨

Template::Stash::ForceUTF8 β€” it forces the UTF-8 (Unicode) flag onto your stash variables. no cap. that's the whole job and she does it flawlessly πŸ’…


🌸 SYNOPSIS 🌸

here's the vibe, copy-paste energy, do not touch a single character:

use Template::Stash::ForceUTF8;
use Template;

my $tt = Template->new(
    LOAD_TEMPLATES => [ Template::Provider::Encoding->new ],
    STASH => Template::Stash::ForceUTF8->new,
);

my $vars;
$vars->{foo} = "\x{5bae}\x{5ddd}";         # Unicode flagged
$vars->{bar} = "\xe5\xae\xae\xe5\xb7\x9d"; # UTF-8 bytes

$tt->process($template, $vars); # this DWIMs

look at that last comment. # this DWIMs. she literally does what you mean. main character behaviour fr fr 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

Template::Stash::ForceUTF8 is a Template::Stash that forces the Unicode flag on stash variables. that's it, that's the tea β˜•

and the glow-up tip: she is best used with Template::Provider::Encoding. they're a duo. a duo that ate πŸ’…βœ¨


πŸ”₯ SEE ALSO πŸ”₯

  • Template::Provider::Encoding β€” her partner in crime, go read that one too bestie

lowkey reminder: you're getting a <pink>Template::Stash</pink> subclass here, not a whole new templating engine. keep your expectations iconic and realistic 🌈

this page shipped with perl v5.34.0 and was dated 2022-06-17, straight out of the User Contributed Perl Documentation corner of the world. mwah, go force some flags on your stash, you've got this πŸ’–πŸŽ€πŸ§šβ­πŸ‘‘

πŸ“¦ where this page comes from