我正在尝试创建一个测试文件,使用模板工具包将模板值输入到字符串中,但我不知道要包含哪些检查/测试以确保模板工具包正确处理字符串。这是我的代码:
#!/usr/bin/env perl
use lib ('./t/lib/');
use strict;
use warnings;
use Template;
use Test::More tests => 1;
# options/configuration for template
my $config = {
#PRE_PROCESS => 1, # means the templates processed can use the same global vars defined earlier
#INTERPOLATE => 1,
#EVAL_PERL => 1,
RELATIVE => 1,
OUTPUT_PATH => './out',
};
my $template = Template->new($config);
# input string
my $text = "This is string number [%num%] .";
# template placeholder variables
my $vars = {
num => …Run Code Online (Sandbox Code Playgroud)