Hi,
The catch command already executes the wrapped expression. So you could use [catch { eval $cmd } myresult]. Wrapping eval $cmd in square braces executes the output of eval again resulting in the invalid command name. Here's a version which should work and not require escaping the characters in the command:
when HTTP_REQUEST {
set cmd {if { [HTTP:uri] starts_with "/hello" }{ log local0.alert "match!!!" }}
if { [catch {
eval $cmd
} myresult] != 0 } {
log local0. "My rule failed: $myresult, \$cmd: $cmd"
} else {
log local0. "My rule succeeded: $myresult, \$cmd: $cmd"
}
}
That said, why do you want to use catch for this? catch handles errors, but it's not too likely that you'd get a runtime error with that anyhow.
Aaron