我在全局函數中使用heredoc中的beestings時遇到了麻煩。運行時會引發錯誤「Exception: arg2 is not defined
」。這裏有一個例子:全局函數中的heredoc中的beestings
ruleset a163x59 {
meta {
name "Beesting in heredoc"
description <<
Demonstrate the error with beestings in global function heredocs
>>
author "Steve Nay"
logging on
}
dispatch {
}
global {
myFunc = function(arg1, arg2) {
firstString = "This is a regular string: #{arg1}. No problem there.";
secondString = <<
This is a heredoc with a beesting: #{arg2}. Problem!
>>;
secondString;
};
}
rule first_rule {
select when pageview ".*" setting()
pre {
msg = myFunc("First argument", "Second argument");
}
notify("Testing...", msg) with sticky = true;
}
}
它從來沒有抱怨arg1
被不確定的,這表明,使用普通的字符串內使用beesting就好了。
有沒有我做錯了,或者這是一個錯誤?
獎勵積分(無論如何都是虛擬點...)用於發佈代碼示例。它使得回答問題變得更容易! – TelegramSam 2011-03-26 04:03:05