lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Monday 12 February 2007, Robert Raschke wrote:
> I use some handlers and they are very easy to use.

thanks, that's good to know

> I took the cgiluahandler and customised it as far as I needed.  I
> didn't really look at performance in any detail, so I drop down into
> cgilua to generate my end result pages based upon some parsing of the
> http line in the handler.

the point with CGILua is that it favors isolation over persistance or 
performance; therefore it creates a whole new Lua state (that's what Rings 
do), and load all the CGILua modules *for each HTTP request*

a handler, OTOH, is just a function that gets called for each request. you 
could setup anything on advance on module initialization, ready to be used 
when the client asks for it.

for example, i like to precompile .lp templates into functions at load time.  
there's even some code to turn a .lp file into a handler, you can simply 
register it to handle a single URL (your AJAX response, maybe?), and get real 
fast responses with the usual template-driven ease.

> I think the one thing that may not be entirely obvious from the docs,
> is that the handlers provided by the distro can be viewed as
> _examples_.

right, what i'd like to make clear is that i assume that any webcoding should 
be done as handlers, maybe just the static pages (and images) served by 
a 'generic' handler.


-- 
Javier

Attachment: pgpMcOFlza5X8.pgp
Description: PGP signature