mod_parrot Registry Scripts
Submitted by jeff on September 4, 2007 - 2:55pm.
mod_parrot now supports registry scripts for the Perl6 and NQP languages. Behold:
sub handler($r)
{
our $x;
unless ($x) {
$x = 1;
}
print "<h1>Hello, I'm a mod_perl6 registry script!</h1>\n";
print "Page views for this interpreter: $x\n";
$x++;
}
And the corresponding Apache configuration for the script directory:
Alias /perl6-bin/ /home/jeff/mod_parrot/perl6-bin/
<Directory /home/jeff/mod_parrot/perl6-bin>
SetHandler parrot-code
ParrotLanguage perl6
ParrotHandler ModPerl6::Registry
Order allow,deny
Allow from all
</Directory>
This script returns a page with number of times it's been called for that instance of the parrot interpreter. It demonstrates the persistence of the interpreter by storing the count in the $x variable between requests. Pretty simple, but it shows how mod_parrot can load, compile, and run code from a file in any supported language.
