[svn:mod_parrot] r523 - in mod_parrot/trunk/languages/perl6/lib: . ModPerl6
[email protected] Fri, 5 Dec 2008 10:49:22 -0800 (PST)
| Newsgroups | perl.cvs.mod_parrot |
|---|---|
| Message-ID | <[email protected]> |
Author: jhorwitz
Date: Fri Dec 5 10:49:21 2008
New Revision: 523
Modified:
mod_parrot/trunk/languages/perl6/lib/ModPerl6/Registry.pm
mod_parrot/trunk/languages/perl6/lib/mod_perl6.pm
Log:
move ParseHeaders to directory config
Modified: mod_parrot/trunk/languages/perl6/lib/ModPerl6/Registry.pm
==============================================================================
--- mod_parrot/trunk/languages/perl6/lib/ModPerl6/Registry.pm (original)
+++ mod_parrot/trunk/languages/perl6/lib/ModPerl6/Registry.pm Fri Dec 5 10:49:21 2008
@@ -54,6 +54,8 @@
sub handler($r)
{
my %cfg = ModParrot::Apache::Module::get_config("modparrot_perl6_module");
+ my %dircfg = ModParrot::Apache::Module::get_config(
+ "modparrot_perl6_module", $r.per_dir_config());
my $script = $r.filename();
unless (%registry{$script}) {
@@ -94,7 +96,7 @@
my $buf = $interp.dump_stdout();
$interp.capture_stdout(0);
- if (%cfg<options><parseheaders>) {
+ if (%dircfg<options><parseheaders>) {
parse_headers($r, $buf);
}
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 Fri Dec 5 10:49:21 2008
@@ -41,16 +41,11 @@
{
my %cfg;
- # options set with Perl6Options
- %cfg<options> = {
- parse_headers => True,
- };
-
# preloading
%cfg<preloaded_modules> = [];
%cfg<postconfig_requires> = [];
- # server-scope handlers
+ # server-scope config
# XXX we shouldn't need to prepopulate these, but things segfault otherwise
for <open_logs post_config child_init pre_connection process_connection
post_read_request map_to_storage trans> -> $phase {
@@ -64,16 +59,33 @@
{
my %cfg;
- # section-scope handlers
+ # section-scope config
# XXX we shouldn't need to prepopulate these, but things segfault otherwise
for <header_parser access authen authz response type fixup log
cleanup> -> $phase {
%cfg{$phase ~ '_handler'} = undef;
}
+ # options set with Perl6Options
+ %cfg<options> = {
+ parse_headers => False,
+ };
+
return %cfg;
}
+sub dir_merge(%base, %new)
+{
+ # merge options -- inherit only if not set
+ for %base<options>.keys -> $k {
+ unless %new<options>.exists($k) {
+ %new<options>{$k} = %base<options>{$k};
+ }
+ }
+
+ return %new;
+}
+
# XXX should cache the handler form during configuration
sub call_handler($ctx, $handler, *@args)
{
@@ -154,6 +166,7 @@
my %cfg = ModParrot::Apache::Module::get_config("modparrot_perl6_module");
# preload modules
+ # NOTE: Perl6Module is a directory scope directive
for %cfg<preloaded_modules>.values -> $m {
use $m;
}
@@ -188,13 +201,12 @@
sub cmd_perl6options(%mconfig, @args)
{
- my %cfg := ModParrot::Apache::Module::get_config("modparrot_perl6_module");
if (@args[0] ~~ /(\+|\-)(.+)/) {
my $modifier = $0;
my $option = $1.lc;
my $val = ($modifier eq '+');
if (%valid_options{$option}) {
- %cfg<options>{$option} = $val;
+ %mconfig<options>{$option} = $val;
}
else {
default { die "invalid option '$option'"; }
@@ -211,14 +223,14 @@
'name' => 'Perl6Options',
'args_how' => $Apache::Const::ITERATE,
'func' => &cmd_perl6options,
- 'req_override' => $Apache::Const::RSRC_CONF,
+ 'req_override' => $Apache::Const::OR_ALL,
'errmsg' => 'usage: Perl6Options [+/-]option ...'
},
{
'name' => 'Perl6Module',
'args_how' => $Apache::Const::TAKE1,
'func' => &cmd_perl6module,
- 'req_override' => $Apache::Const::RSRC_CONF,
+ 'req_override' => $Apache::Const::OR_ALL,
'errmsg' => 'usage: Perl6Module module'
},
{