开发者

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

开发者 https://www.devze.com 2023-03-27 12:11 出处:网络
I\'m writing it this way but it\'s causing my program to abort: HTML::Template::Pro->new(filename=>$file, filter => $filter ? $filter : undef);

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

精彩评论

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