[svn:mod_parrot] r423 - in mod_parrot/branches/hll-modules: languages/perl6/lib lib/ModParrot/HLL
[email protected] Thu, 18 Sep 2008 12:04:22 -0700 (PDT)
| Newsgroups | perl.cvs.mod_parrot |
|---|---|
| Message-ID | <[email protected]> |
Author: jhorwitz
Date: Thu Sep 18 12:04:21 2008
New Revision: 423
Modified:
mod_parrot/branches/hll-modules/languages/perl6/lib/mod_perl6.pm
mod_parrot/branches/hll-modules/lib/ModParrot/HLL/perl6.pir
Log:
migrate configuration handling from PIR to Perl6
Modified: mod_parrot/branches/hll-modules/languages/perl6/lib/mod_perl6.pm
==============================================================================
--- mod_parrot/branches/hll-modules/languages/perl6/lib/mod_perl6.pm (original)
+++ mod_parrot/branches/hll-modules/languages/perl6/lib/mod_perl6.pm Thu Sep 18 12:04:21 2008
@@ -43,11 +43,11 @@
return %cfg;
}
-sub handler($ctx)
+sub response_handler($ctx)
{
my $r = $ctx.request_rec();
-# my %cfg = Apache::Module::get_config("modparrot_perl6_module");
+ my %cfg = Apache::Module::get_config("modparrot_perl6_module");
my %dircfg = Apache::Module::get_config("modparrot_perl6_module", $r.per_dir_config());
my $handler = %dircfg{'response_handler'};
@@ -84,3 +84,27 @@
my $status = ::($handler)::handler();
return $status;
}
+
+sub cmd_perl6responsehandler(%dircfg, @args)
+{
+ %dircfg{'response_handler'} = @args[0];
+}
+
+# register configuration directives
+my $TAKE1 = 1;
+my $OR_AUTHCFG = 8;
+my @cmds = (
+ {
+ 'name' => 'Perl6ResponseHandler',
+ 'args_how' => $TAKE1,
+ 'func' => &cmd_perl6responsehandler,
+ 'req_override' => $OR_AUTHCFG,
+ 'errmsg' => 'usage: Perl6ResponseHandler handler-name'
+ }
+);
+
+Apache::Module::add(
+ 'modparrot_perl6_module',
+ 'perl6',
+ @cmds
+);
Modified: mod_parrot/branches/hll-modules/lib/ModParrot/HLL/perl6.pir
==============================================================================
--- mod_parrot/branches/hll-modules/lib/ModParrot/HLL/perl6.pir (original)
+++ mod_parrot/branches/hll-modules/lib/ModParrot/HLL/perl6.pir Thu Sep 18 12:04:21 2008
@@ -19,6 +19,8 @@
.local pmc find_file_in_path
load_bytecode 'languages/perl6/perl6.pbc'
+ load_bytecode 'Apache/Module.pbc'
+ load_bytecode 'ModParrot/Constants.pbc'
$P0 = new 'Env'
$S0 = $P0['PERL6LIB']
@@ -38,77 +40,8 @@
$P0.'register'($P1)
$P1 = get_class ['ModParrot'; 'Context']
$P0.'register'($P1)
-
- # register apache directives
- .local pmc add_module, cmds, ap_const
-
- ap_const = get_root_global ['Apache'; 'Constants'], 'ap_constants'
-
- load_bytecode 'Apache/Module.pbc'
- load_bytecode 'ModParrot/Constants.pbc'
-
- cmds = new 'Array'
- cmds = 2
-
- $P0 = new 'Hash'
- $P1 = new 'String'
- $P1 = 'Perl6ResponseHandler'
- $P0['name'] = $P1
- $P1 = new 'Integer'
- $P1 = ap_const['TAKE1']
- $P0['args_how'] = $P1
- $P1 = get_hll_global [ 'ModParrot'; 'HLL'; 'perl6' ], 'cmd_perl6responsehandler'
- $P0['func'] = $P1
- $P1 = new 'Integer'
- $P1 = ap_const['OR_AUTHCFG']
- $P0['req_override'] = $P1
- $P1 = new 'String'
- $P1 = "usage: Perl6ResponseHandler handler-name"
- $P0['errmsg'] = $P1
- cmds[0] = $P0
-
- $P0 = new 'Hash'
- $P1 = new 'String'
- $P1 = 'Perl6Module'
- $P0['name'] = $P1
- $P1 = new 'Integer'
- $P1 = ap_const['TAKE1']
- $P0['args_how'] = $P1
- $P1 = get_hll_global [ 'ModParrot'; 'HLL'; 'perl6' ], 'cmd_perl6module'
- $P0['func'] = $P1
- $P1 = new 'Integer'
- $P1 = ap_const['RSRC_CONF']
- $P0['req_override'] = $P1
- $P1 = new 'String'
- $P1 = "usage: Perl6Module module"
- $P0['errmsg'] = $P1
- cmds[1] = $P0
-
- add_module = get_hll_global [ 'Apache'; 'Module' ], 'add'
- $P1 = add_module("modparrot_perl6_module", "perl6", cmds)
.end
# declare namespace AFTER loading compiler
# otherwise we get method resolution errors
.namespace [ 'ModParrot'; 'HLL'; 'perl6' ]
-
-# helper functions go here
-
-.sub cmd_perl6responsehandler
- .param pmc dircfg
- .param pmc args
- .local string handler
- .local pmc mp_const
-
- handler = args[0]
- dircfg['response_handler'] = handler
-.end
-
-.sub cmd_perl6module
- .param pmc cfg
- .param pmc args
- $P0 = get_hll_global [ 'ModParrot'; 'HLL'; 'perl6' ], '@preloaded_modules'
- $P1 = new 'Perl6Str'
- $P1 = args[0]
- $P0.push($P1)
-.end