Using Your Custom Scanner
my $text =<<'EOF'; This is [b]some bold text[/b] This is [i]some italic text[/i] EOF print $scanner->scan($text)->tree->text;
Thus Spake Andy:
Now that we've defined a scanner object we can use it to scan our template
text. The scan()
method returns a Template::TT3::Tokens
object which
contains the tokens scanned from the template. This has a tree()
method
which parses the tokens into a tree of expressions, represented by a
Template::TT3::Tree
object. That has a text()
method which evaluates
(i.e. "runs") the template to generate some output text.