.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Text::Xslate::Bridge::Star 3pm" .TH Text::Xslate::Bridge::Star 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Text::Xslate::Bridge::Star \- Selection of common utilities for templates .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Text::Xslate; \& \& my $tx = Text::Xslate\->new( \& module => [\*(AqText::Xslate::Bridge::Star\*(Aq], \& ); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This module provides a selection of utilities for templates. .SH FUNCTIONS .IX Header "FUNCTIONS" .ie n .SS lc($str) .el .SS \f(CWlc($str)\fP .IX Subsection "lc($str)" Returns a lower-cased version of \fR\f(CI$str\fR\fI\fR. The same as \f(CWCORE::lc()\fR, but returns undef if \fI\fR\f(CI$str\fR\fI\fR is undef. .PP See "lc" in perldoc for details. .ie n .SS uc($str) .el .SS \f(CWuc($str)\fP .IX Subsection "uc($str)" Returns a upper-cased version of \fR\f(CI$str\fR\fI\fR. The same as \f(CWCORE::uc()\fR, but returns undef if \fI\fR\f(CI$str\fR\fI\fR is undef. .PP See "uc" in perldoc for details. .ie n .SS """substr($str, $offset, $len)""" .el .SS "\f(CWsubstr($str, $offset, $len)\fP" .IX Subsection "substr($str, $offset, $len)" Extracts a substring out of \fR\f(CI$str\fR\fI\fR and returns it. The same as \f(CWCORE::substr()\fR, but returns undef if \fI\fR\f(CI$str\fR\fI\fR is undef. .PP See "substr" in perldoc for details. .ie n .SS """sprintf($fmt, args...)""" .el .SS "\f(CWsprintf($fmt, args...)\fP" .IX Subsection "sprintf($fmt, args...)" Returns a string formatted by the \f(CWCORE::sprintf()\fR. \&\f(CW$fmt\fR must be a defined value. .PP See "sprintf" in perldoc for details. .ie n .SS rx($regex_pattern) .el .SS \f(CWrx($regex_pattern)\fP .IX Subsection "rx($regex_pattern)" Compiles \fR\f(CI$regex_patter\fR\fI\fR as a regular expression and return the regex object. You can pass a regex object to \f(CWmatch()\fR or \f(CWreplace()\fR described below. The same as \f(CW\*(C`qr//\*(C'\fR operator in Perl. .ie n .SS """match($str, $pattern)""" .el .SS "\f(CWmatch($str, $pattern)\fP" .IX Subsection "match($str, $pattern)" Tests if \fR\f(CI$str\fR\fI\fR matches \fI\fR\f(CI$pattern\fR\fI\fR. \fI\fR\f(CI$pattern\fR\fI\fR may be a string or a regex object. .PP Like \f(CW\*(C`$str =~ $pattern\*(C'\fR in Perl but you have to pass a regex object explicitly if you can use regular expressions. .PP Examples: .PP .Vb 3 \& : 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 .Ve .ie n .SS """replace($str, $pattern, $replacement)""" .el .SS "\f(CWreplace($str, $pattern, $replacement)\fP" .IX Subsection "replace($str, $pattern, $replacement)" Replaces all the \fR\f(CI$pattern\fR\fI\fRs in \fI\fR\f(CI$str\fR\fI\fR with \fI\fR\f(CI$replacement\fR\fI\fRs. Like as \f(CW\*(C`$str =~ s/$pattern/$replacement/g\*(C'\fR but you have to pass a regex object explicitly if you can use regular expressions. .ie n .SS """split($str [, $pattern [, $limit]])""" .el .SS "\f(CWsplit($str [, $pattern [, $limit]])\fP" .IX Subsection "split($str [, $pattern [, $limit]])" Splits the string \fR\f(CI$str\fR\fI\fR into a list of strings and returns the list. .SH "SEE ALSO" .IX Header "SEE ALSO" Text::Xslate .PP Text::Xslate::Bridge .PP perlfunc