request_rec goodness

jhorwitz on 2004-09-17T23:49:07

Three weeks of work on mod_parrot have culminated in this piece of code: .namespace [ 'MyHandler' ]

.sub _handler .local pmc r

find_type $I0, 'Apache::RequestRec' r = new $I0 r.'puts'("Just a bunch of text.") .end
I was able to encapsulate Apache's request_rec structure in a Parrot object, and I've implemented a 'puts' method that calls ap_rputs using the request_rec and the supplied string.

You can use this as a content handler in httpd.conf: SetHandler parrot-code ParrotHandler MyHandler /path/to/bytecode

Now, you can write entire handlers in Parrot, but the real goal is to have higher-level languages use Parrot to instantiate Apache::RequestRec objects and use them as they see fit for mod_perl, mod_python, or mod_whatever. mod_parrot will act as the layer between the language and Apache -- infrastructure we can write once instead of once for each language. A lofty goal, yes, but so is everything with Parrot.

Source code is coming soon.


dude

geoff on 2004-09-18T15:34:32

you rock!