Text::...::Star(3pm)

✨ NAME ✨

Text::Xslate::Bridge::Star β€” it's the little bridge module that hands your templates a whole glow-up of common utilities, bestie πŸ’– (and yes, the man page header shortens it to Text::...::Star(3pm), she's mysterious like that πŸ’…)


🌸 SYNOPSIS 🌸

use Text::Xslate;

my $tx = Text::Xslate->new(
    module => ['Text::Xslate::Bridge::Star'],
);

okay so you literally just drop the module name into the module array and boom, the utilities show up in your templates. no cap 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

This module gives you a curated lil selection of utilities for templates. that's the whole vibe. ✨


πŸ‘‘ FUNCTIONS πŸ‘‘

πŸ’œ lc($str)

Returns a lower-cased version of $str. Same energy as CORE::lc(), but with one iconic twist: it returns undef if $str is undef. periodt πŸ’…

See "lc" in perldoc for details.


πŸ’œ uc($str)

Returns a upper-cased version of $str. Same as CORE::uc(), except it returns undef if $str is undef. she is NOT about to crash on you fr fr 🫢

See "uc" in perldoc for details.


πŸ’œ "substr($str, $offset, $len)"

Extracts a substring out of $str and returns it. Identical to CORE::substr(), but returns undef if $str is undef. lowkey so polite of her 🌸

See "substr" in perldoc for details.


πŸ’œ "sprintf($fmt, args...)"

Returns a string formatted by CORE::sprintf(). Heads up though bestie: $fmt must be a defined value. ⚠️

See "sprintf" in perldoc for details.


πŸ’œ rx($regex_pattern)

Compiles $regex_patter as a regular expression and returns the regex object. you can then pass that regex object to match() or replace() (they're right below, keep scrolling πŸ“œ). basically the same thing as the "qr//" operator in Perl. iconic. πŸ”₯

(yes the original says $regex_patter with no n at the end β€” we don't fix it, we respect it, she's doing her best πŸ’€)

πŸ’œ "match($str, $pattern)"

Tests if $str matches $pattern. $pattern may be a string or a regex object. πŸŽ€

It's giving $str =~ $pattern in Perl, but you have to pass a regex object explicitly if you can use regular expressions.

Examples, bc examples eat every single time πŸ‘‘:

: match("foo bar baz", "foo")     ? "true" : "false" # true
: match("foo bar baz", "f..")     ? "true" : "false" # false
: match("foo bar baz", rx("f..")) ? "true" : "false" # true

πŸ’œ "replace($str, $pattern, $replacement)"

Replaces all the $patterns in $str with $replacements. Like $str =~ s/$pattern/$replacement/g but again β€” you have to pass a regex object explicitly if you can use regular expressions. it's the rule, she's strict, she's right ✨


πŸ’œ "split($str [, $pattern [, $limit]])"

Splits the string $str into a list of strings and returns the list. that's it, that's the function, she's simple and she's thriving 🌈


🌟 SEE ALSO 🌟

  • Text::Xslate
  • Text::Xslate::Bridge
  • perlfunc

and that's the whole page bestie!! πŸ’–βœ¨ this was perl v5.42.3, dated 2026-08-22, straight out of the User Contributed Perl Documentation vault. go forth and template, you absolute main character πŸŽ€πŸ¦‹πŸ‘‘

πŸ“¦ where this page comes from