Forum OpenACS Q&A: Debugging Tcl

Collapse
Posted by Ramakrishna Bodi on
Am new to OpenACS, so please forgive if am repeating an old question

I have setup project-open and making some code changes in Tcl scripts, however they wouldn't get reflected in the page until I restart the nsd webserver

From what I read this scripting should be similar to ASP as in interpreted so changes should be reflecting instantly

Please help me with necessary config to get going

Thanks in advance
Ramakrishna

Collapse
2: Re: Debugging Tcl (response to 1)
Posted by Iuri Sampaio on
You may be writing within <package>/tcl/ad-proc-library.tcl

They are cached by Naviserver. To apply your amends, and get results instantly, you must put your library, or any other, in the watch list, by clicking in the link "Changed", in the developer's navigation header. Visit: /acs-admin/apm/?reload_links_p=1

A drastic option would be to restart NaviServer. Depending on the hardware, booting up a clean installation would be fast.

So, to write Tcl code and see the results instantly you can use the "Developer watch list", or write you can place your code within /www or /packages/your-pkg/www/

p.s. forget about ASP. not everything! :)

Collapse
3: Re: Debugging Tcl (response to 1)
Posted by Gustaf Neumann on
One has to distinguish between "web pages" and "API":
  • "web pages" are interpreted on the fly. These are located roughly speaking in the "*/www/*" libraries of the server or the package. Also included parts of a page are (located typically in */lib/*) are loaded this way (see [1,2]).
  • API: The definitions of the OpenACS API are reloaded upon request by a site-wide admin, typically via /acs-admin/apm/. It is possible to check for all changed files, or to reload the code package-wise. It is also possible to watch files (i.e. to reload these files automatically, when these are changed).

In rare situations, it is necessary to restart the server including

  • version upgrades
  • code which a loaded explicitly only once such as content of */tcl/*-init.tcl files
  • code in special purpose threads (scheduled procedures) in versions up to OpenACS 5.9.1. This has changed in the forthcoming OpenACS 5.10.* version (see dynamic reloading reform in [3])

[1] https://openacs.org/doc/packages
[2] https://openacs.org/doc/acs-templating/guide/composite
[3] https://openacs.org/xowiki/openacs-todo