Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
想要在perl模板工具包的if循环中编写or条件吗_Perl_Template Toolkit - Fatal编程技术网

想要在perl模板工具包的if循环中编写or条件吗

想要在perl模板工具包的if循环中编写or条件吗,perl,template-toolkit,Perl,Template Toolkit,我想写,如果条件为或条件: [% IF bug.product == 'CustomerCare' or bug.product =='Alerts' or bug.product =='Chatlog' %] <tr><td colspan="2"> <h3 align="center">Have you verified the Checklist ?</h3></td></tr> <tr>

我想写,如果条件为或条件:

[% IF  bug.product == 'CustomerCare' or bug.product =='Alerts' or bug.product =='Chatlog' %]
<tr><td colspan="2">   <h3 align="center">Have you verified the Checklist ?</h3></td></tr>

<tr> 
    <td>  
        <input type="checkbox" id="chck1" name="greet" value="1" [% FOREACH gre =  chk_greet%] checked [% END%] /> 
    </td>

    <td> 
        <label for = "chck1">  Greet the customer ?</label> 
    </td>
</tr>

<tr>
    <td> <input type="checkbox" id="chck2" name="issue_status" value="1" [% FOREACH iss =  chk_issustat%] checked [% END%] /> 
    </td>
    <td> <label for = "chck2">Issue under concern and its status (whether resolved or not)</label> </td> 
</tr>

<tr> 
    <td> 
        <input type="checkbox" id="chck3" name="done_fix" value="1" [% FOREACH don = chk_done%] checked [% END%] [% END %]/> 
    </td> 
</tr> 
[%IF bug.product=='CustomerCare'或bug.product=='Alerts'或bug.product=='Chatlog%]
你核对过清单了吗?
向顾客打招呼?
关注的问题及其状态(无论是否已解决)
写入此条件的正确格式是什么?

读取。它包括你的案例的例子

[% IF (bug.product == 'CustomerCare') || (bug.product =='Alerts') ... %]
阅读。它包括你的案例的例子

[% IF (bug.product == 'CustomerCare') || (bug.product =='Alerts') ... %]

如果您的值列表开始变得有点大,那么使用hashref是简化此逻辑的另一种方法-特别是如果您要反复编写它。它还使逻辑更加清晰,不那么冗长

[%- # Do this once, near the top.
    SET checklistable = { CustomerCare => 1, Alerts => 1, Chatlog => 1 }; -%]

[%- # then later on, as required;
    IF checklistable.item(bug.product);
        ....
    END; -%]

如果您的值列表开始变得有点大,那么使用hashref是简化此逻辑的另一种方法-特别是如果您要反复编写它。它还使逻辑更加清晰,不那么冗长

[%- # Do this once, near the top.
    SET checklistable = { CustomerCare => 1, Alerts => 1, Chatlog => 1 }; -%]

[%- # then later on, as required;
    IF checklistable.item(bug.product);
        ....
    END; -%]

这是或可以放在两个条件之间吗?这是正确的方法吗?这是或可以放在两个条件之间吗?这是正确的方法吗?