我在全局函数中使用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