lua-users home
lua-l archive

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


On Sunday 14 August 2005 10:29 pm, William Trenker wrote:
> Here's another, related, idea.  How about exposing the rules-setting
> code as part of the Xavante API?  In other word, how about being able
> to add / change / delete rules on the fly.  Then a master script could
> change the rules depending on certain input conditions and other
> factors that change dynamically.

xavante.httpd.addHandler() is a public function, Sajax uses it to register 
callbacks dynamically.

> > function loginHandler (req, res)
.........
> > end
>
> I've tried out something like this and it definitely has merit.  I'll
> keep experimenting.

my idea since the first designs of what is now Xavante is to make it easy to 
write code to handle requests.  the content managing is well served by CGIs 
and server pages (and CGILua / .lp in Lua); the coding is the void i want to 
fill.  almost every time andre and i argue about how to do something, my 
answer is "just write a handler"

in fact, i think only a few handlers should be generic and reusable; most 
should be no more reused than the typical PHP code.

special-purpose code is cheaper; and as you go, you'll create your own library 
of helper functions.  (we're still missing a lot of these)

> And, If I may be so bold, to move some of the CGILua core into the
> Xavante handler API.  In my original post, I exposed CGILua's

well, i've just coded cookies and session modules for Xavante, to be used from 
handlers, without CGILua.

there's still no parameters parsing; but a simple :
  for k,v in string.gfind (qry, "([^&=]*)=([^&=]*)")
    params[k]=unencode (v)
  end

gets you a long way

> another way of looking at what I'm trying to implement: I see a master
> script as a dispatcher with several, small .lp CGILua scripts as user
> input forms.  The master script coordinates everything including using

yep!  that's very close to what i've been thinking about 'dispatching 
handlers'

and as for ".lp CGILua scripts" i've just added the capability to write 
handlers using the same syntax as .lp   note that these aren't CGILua .lp!  
just a neat way to write xavante handlers

what else is coming?... two things: a framewark to write a full website as a 
lua module (using require() and module())  and a coroutine-based procedural 
framework, where a user session is handled as program flow...

-- 
Javier

Attachment: pgpM5jWwfNveH.pgp
Description: PGP signature