First mod_perl6 handlers

Jeff Horwitz, who has previously embedded Perl 5 code in Oracle PL/SQL code, has embedded Perl 6 in Apache. He writes on the perl6-internals list today that:

It gives me great pleasure to introduce you to the world's first mod_perl6 handlers! They are run using Parrot's Perl6 compiler on top of mod_parrot, and are compiled on the fly the first time a handler is called. Each handler is passed an Apache::RequestRec object instantiated by mod_parrot, and the handlers can call methods on that object from Perl6 land.

The code is simple and familiar, yet uses new Perl 6 constructs.

sub counter_handler($r)
{
    our $x;
    unless ($x) {
        $x = 1;
    }
    $r.puts("<h1>Hello, I'm a mod_perl6 response handler!</h1>\n");
    $r.puts("Page views for this interpreter: $x\n");
    $x++;
    0; # Apache OK
}

Seeing working Perl 6 code, especially interoperating with other software, is what Parrot and Perl 6 need to show the community that these two projects, crucial to the future of Perl, are making progress. Bravo, Jeff!

0 TrackBacks

Listed below are links to blogs that reference this entry: First mod_perl6 handlers.

TrackBack URL for this entry: http://perlbuzz.com/cgi-bin/mt/mt-tb.cgi/92

Leave a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About this Entry

This page contains a single entry by Andy Lester published on September 6, 2007 10:51 PM.

Test::Harness 3 alpha released was the previous entry in this blog.

YAML spec for Change logs is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Technorati Profile