[svn:mod_parrot] r469 - in mod_parrot/trunk: build/lib/Generator eg/perl6 eg/perl6/ModPerl6 languages/perl6/lib languages/perl6/lib/Apache languages/perl6/lib/ModParrot
[email protected] Wed, 22 Oct 2008 11:43:11 -0700 (PDT)
| Newsgroups | perl.cvs.mod_parrot |
|---|---|
| Message-ID | <[email protected]> |
Author: jhorwitz
Date: Wed Oct 22 11:43:11 2008
New Revision: 469
Added:
mod_parrot/trunk/languages/perl6/lib/Apache/
mod_parrot/trunk/languages/perl6/lib/Apache/Const.pm
mod_parrot/trunk/languages/perl6/lib/Apache/ConstHelper.pir
mod_parrot/trunk/languages/perl6/lib/ModParrot/
mod_parrot/trunk/languages/perl6/lib/ModParrot/Const.pm
mod_parrot/trunk/languages/perl6/lib/ModParrot/ConstHelper.pir
Modified:
mod_parrot/trunk/build/lib/Generator/ApacheConstants.pm
mod_parrot/trunk/build/lib/Generator/ModParrotConstants.pm
mod_parrot/trunk/eg/perl6/ModPerl6/Counter.pm
mod_parrot/trunk/eg/perl6/ModPerl6/Polly.pm
mod_parrot/trunk/eg/perl6/counter
mod_parrot/trunk/languages/perl6/lib/mod_perl6.pm
Log:
implement Apache::Const and ModParrot::Const
Modified: mod_parrot/trunk/build/lib/Generator/ApacheConstants.pm
==============================================================================
--- mod_parrot/trunk/build/lib/Generator/ApacheConstants.pm (original)
+++ mod_parrot/trunk/build/lib/Generator/ApacheConstants.pm Wed Oct 22 11:43:11 2008
@@ -139,7 +139,7 @@
.sub _init_const_table
.local pmc table
- table = new 'OrderedHash'
+ table = new 'Hash'
# Handler Responses
%%HANDLER%%
Modified: mod_parrot/trunk/build/lib/Generator/ModParrotConstants.pm
==============================================================================
--- mod_parrot/trunk/build/lib/Generator/ModParrotConstants.pm (original)
+++ mod_parrot/trunk/build/lib/Generator/ModParrotConstants.pm Wed Oct 22 11:43:11 2008
@@ -107,7 +107,7 @@
.sub _init_const_table
.local pmc table
- table = new 'OrderedHash'
+ table = new 'Hash'
%%CONFIG%%
Modified: mod_parrot/trunk/eg/perl6/ModPerl6/Counter.pm
==============================================================================
--- mod_parrot/trunk/eg/perl6/ModPerl6/Counter.pm (original)
+++ mod_parrot/trunk/eg/perl6/ModPerl6/Counter.pm Wed Oct 22 11:43:11 2008
@@ -23,6 +23,7 @@
module ModPerl6::Counter;
use v6;
+use Apache::Const;
sub handler($r)
{
@@ -32,5 +33,5 @@
}
$r.puts("Page views for this interpreter: $x\n");
$x++;
- 0; # Apache OK
+ return $Apache::Const::OK;
}
Modified: mod_parrot/trunk/eg/perl6/ModPerl6/Polly.pm
==============================================================================
--- mod_parrot/trunk/eg/perl6/ModPerl6/Polly.pm (original)
+++ mod_parrot/trunk/eg/perl6/ModPerl6/Polly.pm Wed Oct 22 11:43:11 2008
@@ -20,6 +20,7 @@
module ModPerl6::Polly;
use v6;
+use Apache::Const;
sub handler($r)
{
@@ -28,5 +29,5 @@
$r.puts("SQUAWK! Polly says $text<p>");
}
$r.puts("Reload with a query string and Polly will repeat it.\n");
- 0; # Apache OK
+ return $Apache::Const::OK;
}
Modified: mod_parrot/trunk/eg/perl6/counter
==============================================================================
--- mod_parrot/trunk/eg/perl6/counter (original)
+++ mod_parrot/trunk/eg/perl6/counter Wed Oct 22 11:43:11 2008
@@ -11,12 +11,11 @@
#
# ParrotIncludePath /path/to/eg/perl6:/path/to/parrot/runtime/parrot/library:/pa
th/to/mod_parrot/lib
-# ParrotLoad ModParrot/HLL/perl6.pbc
-# ParrotAddHandler perl6 perl6-script
+# ParrotLoadImmediate ModParrot/HLL/perl6.pbc
# <Directory /path/to/perl6-bin>
# Options +ExecCGI
# SetHandler perl6-script
-# ParrotHandler ModPerl6::Registry
+# Perl6ResponseHandler ModPerl6::Registry
# </Directory>
our $x;
Added: mod_parrot/trunk/languages/perl6/lib/Apache/Const.pm
==============================================================================
--- (empty file)
+++ mod_parrot/trunk/languages/perl6/lib/Apache/Const.pm Wed Oct 22 11:43:11 2008
@@ -0,0 +1,5 @@
+# $Id
+
+module Apache::Const;
+
+use Apache::ConstHelper;
Added: mod_parrot/trunk/languages/perl6/lib/Apache/ConstHelper.pir
==============================================================================
--- (empty file)
+++ mod_parrot/trunk/languages/perl6/lib/Apache/ConstHelper.pir Wed Oct 22 11:43:11 2008
@@ -0,0 +1,25 @@
+# $Id$
+
+# XXX this will eventually be done in pure Perl 6
+
+.include "iterator.pasm"
+
+.sub '' :anon :load
+ .local pmc c_iter, c, v
+ .local string k, name
+
+ c = get_root_global ['ModParrot'; 'Apache'; 'Constants'], 'table'
+ c_iter = new 'Iterator', c
+ c_iter = .ITERATE_FROM_START
+ iter_start:
+ unless c_iter goto iter_end
+ k = shift c_iter
+ $I0 = c[k]
+ v = new 'Integer'
+ v = $I0
+ name = '$'
+ name .= k
+ set_hll_global ['Apache'; 'Const'], name, v
+ goto iter_start
+ iter_end:
+.end
Added: mod_parrot/trunk/languages/perl6/lib/ModParrot/Const.pm
==============================================================================
--- (empty file)
+++ mod_parrot/trunk/languages/perl6/lib/ModParrot/Const.pm Wed Oct 22 11:43:11 2008
@@ -0,0 +1,5 @@
+# $Id
+
+module ModParrot::Const;
+
+use ModParrot::ConstHelper;
Added: mod_parrot/trunk/languages/perl6/lib/ModParrot/ConstHelper.pir
==============================================================================
--- (empty file)
+++ mod_parrot/trunk/languages/perl6/lib/ModParrot/ConstHelper.pir Wed Oct 22 11:43:11 2008
@@ -0,0 +1,25 @@
+# $Id$
+
+# XXX this will eventually be done in pure Perl 6
+
+.include "iterator.pasm"
+
+.sub '' :anon :load
+ .local pmc c_iter, c, v
+ .local string k, name
+
+ c = get_root_global ['ModParrot'; 'Constants'], 'table'
+ c_iter = new 'Iterator', c
+ c_iter = .ITERATE_FROM_START
+ iter_start:
+ unless c_iter goto iter_end
+ k = shift c_iter
+ $I0 = c[k]
+ v = new 'Integer'
+ v = $I0
+ name = '$'
+ name .= k
+ set_hll_global ['ModParrot'; 'Const'], name, v
+ goto iter_start
+ iter_end:
+.end
Modified: mod_parrot/trunk/languages/perl6/lib/mod_perl6.pm
==============================================================================
--- mod_parrot/trunk/languages/perl6/lib/mod_perl6.pm (original)
+++ mod_parrot/trunk/languages/perl6/lib/mod_perl6.pm Wed Oct 22 11:43:11 2008
@@ -17,6 +17,8 @@
module ModParrot::HLL::perl6;
use v6;
+use ModParrot::Const;
+use Apache::Const;
our @preloaded_modules = ();
our @postconfig_requires = ();
@@ -47,7 +49,7 @@
my $r = $ctx.request_rec();
unless ($r.handler() ~~ any(<modperl6 perl6-script>)) {
- return -1; # DECLINED
+ return $Apache::Const::DECLINED
}
my %cfg = ModParrot::Apache::Module::get_config("modparrot_perl6_module");
@@ -95,21 +97,20 @@
}
# register configuration directives
-my $TAKE1 = 1;
-my $OR_AUTHCFG = 8;
my @cmds = (
{
'name' => 'Perl6ResponseHandler',
- 'args_how' => $TAKE1,
+ 'args_how' => $Apache::Const::TAKE1,
'func' => &cmd_perl6responsehandler,
- 'req_override' => $OR_AUTHCFG,
+ 'req_override' => $Apache::Const::OR_AUTHCFG,
'errmsg' => 'usage: Perl6ResponseHandler handler-name'
}
);
# register hooks
-# XXX would be nice to use the enum strings here
-my @hooks = (13);
+my @hooks = (
+ $ModParrot::Const::MP_HOOK_RESPONSE
+);
ModParrot::Apache::Module::add(
'modparrot_perl6_module',