开发者

How do I specify a conditional parameter in HTML::Template::Pro?

I'm writing it this way but it's causing my program to abort:

HTML::Template::Pro->new(filename=>$file, filter => $filter ? $filter : undef);

What's wrong in the above code?

Basically I want the condition开发者_StackOverflow社区al filter to do encode_entities() on each TMPL_VAR.


undef is not a valid value for filter. Instead, omit the filter parameter altogether, like this:

HTML::Template::Pro->new(filename=>$file, $filter ? (filter => $filter) : ());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜