I used "==" in the second comparison instead of "eq" because that's what you had. It should work because the CF id is an integer and get_custom_id() returns an integer or undef, so you're comparing integers. Sometimes perl is pretty good about making things work when they aren't quite correct, so using "eq" might work also.

I don't know enough about perl's guts to be able to say why the "{ ... }" block returns true every time. It's an interesting question, maybe it's a property of code blocks that they are always true. I just know that {braces}, (parentheses), and [brackets] are not interchangeable.

Gene

At 09:09 AM 5/18/2007, Kenneth Crocker wrote:
Gene,


Sorry for all the hassle. In the Perl class I took, I got the impression that it didn't matter what type of brackets you used, as long as they matched left & right. Also, why do you use == in the second line? Why not just another eq? Another question; I was under the impression that if the code failed, nothing happened. In my case it seems that the code was wrong, but I was getting a notification no matter what. That doesn't make sense.

Kenn

Gene LeDuc wrote:
Kenn, you're using curly brackets to enclose the condition phrase. In this case you really don't need to enclose it at all, but if you do then you need to use parentheses.
This should work:
return 1 if $trans->Type eq "CustomField" && $trans->Field == get_custom_id("Approval-Status") && $trans->NewValue eq "Reviewing Request";
This too:
return 1 if ($trans->Type eq "CustomField" && $trans->Field == get_custom_id("Approval-Status") && $trans->NewValue eq "Reviewing Request");
Also:
return ($trans->Type eq "CustomField" && $trans->Field == get_custom_id("Approval-Status") && $trans->NewValue eq "Reviewing Request"); All assuming that the CF name and Value are as stated and that you have the get_custom_id sub at the end of your code.
At 04:30 PM 5/17/2007, Kenneth Crocker wrote:
return 1 if {$trans->Type eq "CustomField" &&
             $trans->Field == get_custom_id('Approval-Status') &&
             $trans->NewValue eq "Reviewing Request"};


--
Gene LeDuc, GSEC
Security Analyst
San Diego State University

_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com

Reply via email to