Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jhorwitz (4227)

  reversethis-{gro.gnihsams} {ta} {ffej}

System administrator, Perl hacker, author of "Unix System Management Primer Plus" (SAMS 2003), mod_parrot, extproc_perl, Authen::Krb4, Authen::Krb5.

Journal of jhorwitz (4227)

Friday September 17, 2004
06:49 PM

request_rec goodness

[ #20928 ]
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.")

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

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.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.