.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:
<Location
/parrot/mydir>
SetHandler parrot-code
ParrotHandler MyHandler/path/to/bytecode
</Location>
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 (Score:2)