I have a script that uses the struct::matrix
package. The following is basically the code I'm using:
body className::methodName {args} {
# ...
::struct::matrix mat
set CSV_file_handle [open $CSV_file_path]
csv::read2matrix $CSV_file_handle mat , auto
close $CSV_file_handle
set workbook_list [mat serialize]
# ...
}
And when executing the file, an error rises (omitted irrelevant info):
$ tclsh script.tcl
invalid command name "mat"
while executing
"$m columns"
(procedure "Split2matrix" line 25)
invoked from within
"Split2matrix $alternate $m $data $sepChar $expand"
(procedure "csv::read2matrix" line 87)
invoked from within
"csv::read2matrix $CSV_file_handle mat , auto"
(object "::classObject" method "::className::methodName" body line ...)
When the line ::struct::matrix mat
is transferred to global scope, then everything work OK.
Do you know how to make it work while the mat
object is defined inside the method's body?
Edit: Forgot to mention - as can be seen from the code, I'm also using the CSV package!