On Sunday 16 March 2003 05:33, you wrote:
> On 2003.03.14, Zoran Vasiljevic <[EMAIL PROTECTED]> wrote:
> > So, I've extended the command set with the "ns_atstartup"
> > command. This registers scripts to be executed immediately
> > before server is going into operation and just after the
> > last initialization script was finished.
>
> How does this differ from putting a script in your tcl library
> named zzz_execute_this_last.tcl ... since scripts get processed
> in alphabetical order by filename?
>
> At that point in the server's life aer it's evaluated all its
> initialization but before it goes into normal operation, are
> there elements of the server available to you that aren't
> available during the actual initialization phase?  What are
> those elements?
>

Simple. The problem is inter-dependency of the code
within scripts executed from shared/private library and
the order how they are executed.

It is quite difficult, and in some circumstances impossible
to desing the order of the execution to fit the alphabetical
order. The problem gets even more complex when you're
making changes to an existing installation (i.e adding and/ot
removing files) and have intermixed shared/private setup
of tcl loaders.

Sometimes you can't just put everyting in the zzzz.tcl script
because you want to keep things nicely modularized.
Sometimes you have to put the code in the file A.tcl which
needs proc definitions from B.tcl and you can't just rely on
the file naming to keep the right order.
Things start to be very interesting when you start to use
some OO-like systems. We're using XOTcl and 98% of
our app is written like that. So, we must really make sure
all those classes are loaded *before* we can start to
use them.

So, althouth it may seem at the first spot that this is
doable with simple naming convention, you pretty soon
find out that it is just not flexible enough.

The real solution would be a FIFO queue where you can
post scripts to run, after loading all proc definitions,
modules, etc. The server will just run those scripts one
after another and at the end enter the normal state.
Now, on the C-level, there are API provisions for that.
They are just not opened on the Tcl-level.

Cheers,
Zoran


--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list: http://www.aolserver.com/listserv.html
List information and options: http://listserv.aol.com/

Reply via email to