Forum OpenACS Q&A: Re: Problems defining procs
23: Re: Problems defining procs (response to 21)
Posted by Jeff Rogers on 06/12/11 08:53 AM
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"?
24: Re: Problems defining procs (response to 23)
Posted by ultra newb on 06/12/11 12:42 PM
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.