Forum OpenACS Q&A: Re: Problems defining procs

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.