|
|
Tcl IssuesThe TCL plugin hasn't been updated in a while, and so there are certain problems that exist for a variety of reasons. The following was given by the user "myeggo" dealing with installing external scripts for use with XChat. myeggo's commentsI was trying to create a net install for my script. Using this command: /tcl package require http; set ::data [http::data [http::geturl http://server/file.tcl]]; set fs [open install.tcl w]; puts $fs $::data; close $fs; source install.tcl saves a file at pwd and source it, it works fine at the moment. I typed this proc in that file: proc download {dir file} { if {[catch {package require http} msg]} { echo "Error loading package http. Install will stop now." return } else { update set token [http::geturl http://server/$dir$file -binary 1] set data [http::data $token] http::cleanup $token return "$data" } } So i save all my script and his files in binary mode (-binary 1) to not get errors with special characters (i am using iso8859 by default) but for some reason, when i save $data (suppose the file online) xchat save the content with wrong encoding. I was trying to understand why it happens and modified my code to try fix that problem, but in tclsh, that proc saves the file with no errors though. Frustrating enough. Since i tested my install in pure tcl and i discovered that it works, i tried this command in xchat:
/tcl interp create install
# this command creates a new interpreter for tcl in xchat, and suppose is not managed by tcl plugin (it is same as open a new tclsh)
/tcl install eval {set fs [open file.tcl w]; puts $fs [download file.tcl]; close $fs}
# use the new interp to execute the command, and works
/tcl interp delete install
# remove it
>><<
I spent half week to discover this, so i hope that can help to anyone It is caused xchat plugin overrides [puts] |
