我在全局函数的heredoc中使用beestings时遇到了麻烦。运行时抛出错误“ Exception: arg2 is not defined
”。这是一个例子:
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 就可以了。
是我做错了什么,还是这是一个错误?