dougm 2002/10/06 19:35:18
Modified:.Changes STATUS
lib/ModPerl TestRun.pm
src/modules/perl mod_perl.c modperl_cmd.c modperl_cmd.h
t/conf modperl_extra.pl
t/directive .cvsignore
todo possible_new_features.txt
Added: lib/Apache PerlSection.pm
t/response/TestDirective perldo.pm
Log:
Submitted by: gozer
Reviewed by: dougm
add default handler Apache::PerlSection.
make blocks to be EXEC_ON_READ so apache does not parse the contents.
add "Perl" directive for general use and for which sections are
stuffed into.
Revision ChangesPath
1.51 +6 -0 modperl-2.0/Changes
Index: Changes
===
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- Changes 7 Oct 2002 02:05:43 - 1.50
+++ Changes 7 Oct 2002 02:35:18 - 1.51
@@ -10,6 +10,12 @@
=item 1.99_08-dev
+add default handler Apache::PerlSection.
+make blocks to be EXEC_ON_READ so apache does not parse the contents.
+add "Perl" directive for general use and for which sections are
+stuffed into.
+[Philippe M. Chiasson <[EMAIL PROTECTED]>]
+
rename overloaded LoadModule directive to PerlLoadModule
=item 1.99_07 - September 25, 2002
1.13 +1 -5 modperl-2.0/STATUS
Index: STATUS
===
RCS file: /home/cvs/modperl-2.0/STATUS,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- STATUS17 Sep 2002 02:46:20 - 1.12
+++ STATUS7 Oct 2002 02:35:18 - 1.13
@@ -54,10 +54,6 @@
Needs Patch or Further Investigation:
-
-* pluggable sections have been implemented but need a default
- handler to actually convert the Perl code into apache config
- [Philippe M. Chiasson <[EMAIL PROTECTED]> is working on one]
-
* Apache->httpd_conf compat method mapping to Apache::Server->add_config
* directive handlers are supported but need some work for 1.x compat
1.1 modperl-2.0/lib/Apache/PerlSection.pm
Index: PerlSection.pm
===
package Apache::PerlSection;
use strict;
use warnings FATAL => 'all';
our $VERSION = '0.01';
use ModPerl::Symdump ();
use Apache::CmdParms ();
use Apache::Directive ();
use constant SPECIAL_NAME => 'PerlConfig';
sub new {
my($package, @args) = @_;
return bless { @args }, ref($package) || $package;
}
sub server { return shift->{'parms'}->server() }
sub directives { return shift->{'directives'} ||= [] }
sub handler : method {
my($self, $parms, $args) = @_;
unless (ref $self) {
$self = $self->new('parms' => $parms, 'args' => $args);
}
my $package = $args->get('package');
my $special = $self->SPECIAL_NAME;
my $root = ModPerl::Symdump->new($package);
my %convert = (
'scalars' => sub { no strict 'refs'; return ${ $_[0] } },
'arrays' => sub { no strict 'refs'; return \@{ $_[0] } },
'hashes' => sub { no strict 'refs'; return \%{ $_[0] } },
);
for my $type (sort keys %convert) {
for my $entry (grep { !/$special/ } $root->$type()) {
(my $name = $entry) =~ s/${package}:://;
$self->dump($name, $convert{$type}->($entry));
}
}
{
no strict 'refs';
$self->dump_special(${"${package}::$special"},
@{"${package}::$special"} );
}
$self->post_config();
Apache::OK;
}
sub dump_special {
my($self, @data) = @_;
$self->add_config(@data);
}
sub dump {
my($self, $name, $entry) = @_;
my $type = ref $entry;
if ($type eq 'ARRAY') {
$self->dump_array($name, $entry);
}
elsif ($type eq 'HASH') {
$self->dump_hash($name, $entry);
}
else {
$self->dump_entry($name, $entry);
}
}
sub dump_hash {
my($self, $name, $hash) = @_;
for my $entry (sort keys %{ $hash || {} }) {
my $item = $hash->{$entry};
my $type = ref($item);
if ($type eq 'HASH') {
$self->dump_section($name, $entry, $item);
}
elsif ($type eq 'ARRAY') {
for my $e (@$item) {
$self->dump_section($name, $entry, $e);
}
}
}
}
sub dump_section {
my($self, $name, $loc, $hash) = @_;
$self->add_config("<$name $loc>\n");
for my $entry (sort keys %{ $hash || {} }) {
$self->dump_entry($entry, $hash->{$entry});