I have very new to Tcl and how it interacts with Cloverleaf. When I test a proc I wrote to remove any “newlines” within the HL7 message I receive the following error when using hcitpstest:
“can’t read “mode”: no such variable
while executing
“switch -exact — $mode {
start {
invoked from within
“remove_illegal_chars { MSGID message 0 } { DISP CONTINUE } { ARGS {} }”
My code is here:
proc remove_illegal_chars { args } {
keylget args MODE mode ;# Fetch mode
set dispList {} ;# Nothing to return
switch -exact — $mode {
start {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
}
run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
set msg [msgget $mh]
regsub -all n $msg { } msg
msgset $mh $msg
lappend dispList “CONTINUE $mh”
}
time {
# Timer-based processing
# N.B.: there may or may not be a MSGID key in args
}
shutdown {
# Doing some clean-up work
}
}
return $dispList
}
First then I noticed is that MODE is not being passed in as argument. I am using the testing tool incorrectly?