The Toolkit for Online Communities
18070 Community Members, 1 member online, 2146 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Q&A : Problems defining procs : One Message

Forum OpenACS Q&A: Re: Problems defining procs

Posted by ultra newb on
Okay, I am indeed getting errors in the log. Here is the relevant portion of the log:

[11/Jun/2011:16:47:14][1032.1992][-thread1992-] Error: tcl: source c:/aolserver/servers/openacs/tcl/exchange-procs.tcl failed: no connection
no connection
while executing
"ns_conn headers"
(procedure "ad_host" line 2)
invoked from within
(procedure "exch" line 2)
invoked from within
"exch MKT"
(procedure "mkt" line 1)
invoked from within
("eval" body line 1)
invoked from within
"eval $script"
invoked from within
"ns_cache eval util_memoize $script {
list $current_time [eval $script]
(procedure "util_memoize" line 20)
invoked from within
"util_memoize mkt"
(file "c:/aolserver/servers/openacs/tcl/exchange-procs.tcl" line 36)
invoked from within
"source $file"

Don't know what "no connection means." If the other poster above is correct, I should put my code in a package... correct? I didn't want to have to create one, but I will try and report back.

Thanks to all for continuing to help - this is a great community.

Posted by Jeff Rogers on
The "no connection" error is telling you that you are trying to perform an operation (in this case, getting the "host" header from the current request) in a context where there is no current request - at startup.

Once an error is raised in a tcl file, nothing further in that file will get executed, including commands to define procs. That would explain why the proc is available if you define it early in the file but not at the end.

To get the name of the server you are on when there is no request, use [ns_info hostname], or could you just use "localhost"?

Posted by ultra newb on
This was indeed the problem! All problems have now been solved, including dynamically-defining a proc.

Also, apparently don't have to define a package.

Thanks to everyone, this was a big help.