This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

TCL HTTP Package

Old posts that have not been replied to for several years.
Locked
X
XceL
Voice
Posts: 20
Joined: Wed Jan 14, 2004 8:57 pm

TCL HTTP Package

Post by XceL »

I know this has been asked probably a billion times but, I for some reason can't get this code to work. My code is similar the code posted below except I changed the URL. Now my problem is when I call my proc from the bind it always gives me an error. Please any help is appriciated :)

Code: Select all

package require http
bind pub - -projects aproc
proc aproc {n u h c t} {
  set token [::http::geturl http://www.tclscript.com/scripts.shtml]
  set data [::http::data $token]
  # parse $data, see how many project lines there is
  puthelp "privmsg $c :total number of projects: $total"
  ::http::cleanup $token
} 

Error:
[20:33] Tcl error [test]: wrong # args: should be "list nick uhost hand chan text"
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

paste your code, not mine :P
X
XceL
Voice
Posts: 20
Joined: Wed Jan 14, 2004 8:57 pm

Post by XceL »

Lol ok here is my code..

Code: Select all

proc test {nick uhost hand chan text} {
  set url "http://www.alt-bin.com/index.php?pg=fd&ch="
  set url2 "alt.binaries.sounds.mp3.complete_cd"
  set url "$url$url2"
  unset url2

  set token [::http::geturl $url]
  set content [::http::data $token]
  ::http::cleanup $token
}
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

when you spot the error message, type .set errorInfo on bot's partyline and paste the result here
X
XceL
Voice
Posts: 20
Joined: Wed Jan 14, 2004 8:57 pm

Post by XceL »

As Requested:
[22:47] <XceL> .set errorInfo
[22:47] <***> [21:44] #XceL# set errorInfo
[22:47] <***> Currently: wrong # args: should be "list nick uhost hand chan text"
[22:47] <***> Currently: while executing
[22:47] <***> Currently: "list $cmd"
[22:47] <***> Currently: (procedure "auto_qualify" line 17)
[22:47] <***> Currently: invoked from within
[22:47] <***> Currently: "auto_qualify $cmd $namespace"
[22:47] <***> Currently: (procedure "auto_load" line 7)
[22:47] <***> Currently: invoked from within
[22:47] <***> Currently: "auto_load $name [uplevel 1 {::namespace current}]"
[22:47] <***> Currently: (autoloading "::http::geturl")
[22:47] <***> Currently: invoked from within
[22:47] <***> Currently: "::http::geturl $url"
[22:47] <***> Currently: (procedure "test" line 7)
[22:47] <***> Currently: invoked from within
[22:47] <***> Currently: "test $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

do you happen to have a proc named "list"? if so, rename it
X
XceL
Voice
Posts: 20
Joined: Wed Jan 14, 2004 8:57 pm

Post by XceL »

I do thanks, may I ask why were they conflicting?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

since
  • is a standard Tcl proc, and you shouldn't override standard Tcl procs (Tcl has no notion of "reserved" words like most programming languages do, and you are allowed to name your procs anything, but it's normally wise to avoid name clashes with standard procs)
Locked