On Friday 02 November 2007 11:50, John Buckman wrote:
> > Can you describe what you are trying to achieve and how you test to
> > see that
> > it isn't working? It would be nice to see some working code/
> > configuration to
> > supplement the documentation.
>
> Quite simply, I prefer aolserver interps to load the source once,
> keep it in memory in parsed form.  This makes page load times fast.
> My .adp files tend to be mostly-empty shells that call .tcl procs, so
> that the procs are parsed and in memory already.
>
> On my development machine, I have aolserver set to re-source all my
> code for each page load. That's a lot slower, but it makes
> development easier.
>
> On a production machine, I would like to "push up" a new web site
> software version w/o restarting the web server.
>
> Make sense?

Yes, lots of sense. 

The development point is interesting. I have been restarting AOLserver (run in 
forground mode) during development, but that would also be slow if I was 
working on a lot of code, like restarting OpenACS. 

But last week I wrote a tcl version of ns_conn and ns_return. This allowed me 
to test library code and tcl page code using nstclsh. At first it was just a 
command line thing, but I just wrote a short script to hook it up to 
tcpserver. Here is the example script (note that ::ns::conn::receive listens 
for a GET/POST on stdin by default):

#!/web/nsd45/bin/nstclsh
# Move into parent of pages directory
set home "/web/nsd45/servers/tutos"
cd $home

# Source tWSDL/TWiST
source "modules/tcl/twsdl/init.tcl"

# Move to pageroot
cd [ns_info pageroot]

# Wait for a request to arrive
::ns::conn::receive

# Assume success 
set status 200

# Convert URL to local file
set targetFile [ns_url2file [ns_conn url]]

# Either file exists or is directory with index.tcl
# If not, return file not found.
if {![file exists $targetFile]} {
    set status 404
} elseif {[file isdirectory $targetFile]} {

    set targetFile [file join $targetFile index.tcl]

    if {![file exists $targetFile]} {
        set status 404
    }
}
if {"$status" ne "200"} {
    ns_return $status text/plain "Issues $status"
    return
}
# File exists
source $targetFile

##########

Suddenly it became a lot faster to develop. Of course this only applies to tcl 
pages, and can't test things like database access. But it is very good for 
testing the actual request/response process.

tom jackson


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to