1Text::Xslate::Bridge::SUtsaerr(3C)ontributed Perl DocumeTnetxatt:i:oXnslate::Bridge::Star(3)
2
3
4
6 Text::Xslate::Bridge::Star - Selection of common utilities for
7 templates
8
10 use Text::Xslate;
11
12 my $tx = Text::Xslate->new(
13 module => ['Text::Xslate::Bridge::Star'],
14 );
15
17 This module provides a selection of utilities for templates.
18
20 "lc($str)"
21 Returns a lower-cased version of $str. The same as "CORE::lc()", but
22 returns undef if $str is undef.
23
24 See "lc" in perldoc for details.
25
26 "uc($str)"
27 Returns a upper-cased version of $str. The same as "CORE::uc()", but
28 returns undef if $str is undef.
29
30 See "uc" in perldoc for details.
31
32 "substr($str, $offset, $len)"
33 Extracts a substring out of $str and returns it. The same as
34 "CORE::substr()", but returns undef if $str is undef.
35
36 See "substr" in perldoc for details.
37
38 "sprintf($fmt, args...)"
39 Returns a string formatted by the "CORE::sprintf()". $fmt must be a
40 defined value.
41
42 See "sprintf" in perldoc for details.
43
44 "rx($regex_pattern)"
45 Compiles $regex_patter as a regular expression and return the regex
46 object. You can pass a regex object to "match()" or "replace()"
47 described below. The same as "qr//" operator in Perl.
48
49 "match($str, $pattern)"
50 Tests if $str matches $pattern. $pattern may be a string or a regex
51 object.
52
53 Like "$str =~ $pattern" in Perl but you have to pass a regex object
54 explicitly if you can use regular expressions.
55
56 Examples:
57
58 : match("foo bar baz", "foo") ? "true" : "false" # true
59 : match("foo bar baz", "f..") ? "true" : "false" # false
60 : match("foo bar baz", rx("f..")) ? "true" : "false" # true
61
62 "replace($str, $pattern, $replacement)"
63 Replaces all the $patterns in $str with $replacements. Like as "$str
64 =~ s/$pattern/$replacement/g" but you have to pass a regex object
65 explicitly if you can use regular expressions.
66
67 "split($str [, $pattern [, $limit]])"
68 Splits the string $str into a list of strings and returns the list.
69
71 Text::Xslate
72
73 Text::Xslate::Bridge
74
75 perlfunc
76
77
78
79perl v5.30.1 2020-01-30 Text::Xslate::Bridge::Star(3)