You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@apache.org on 2001/04/03 02:27:02 UTC

cvs commit: modperl-2.0/Apache-Test/lib/Apache TestConfig.pm TestConfigPerl.pm

dougm       01/04/02 17:27:02

  Modified:    Apache-Test/lib/Apache TestConfig.pm TestConfigPerl.pm
  Log:
  shift certain .pm __DATA__ config directives outside its container, e.g. Alias
  allow containers inside .pm __DATA__ config
  
  Revision  Changes    Path
  1.4       +1 -1      modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm
  
  Index: TestConfig.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestConfig.pm	2001/04/02 20:07:38	1.3
  +++ TestConfig.pm	2001/04/03 00:26:58	1.4
  @@ -221,7 +221,7 @@
       }
       else {
           $args = "$directive " .
  -          (ref($arg) && (ref($arg) eq 'ARRAY') ? "@$arg" : $arg);
  +          (ref($arg) && (ref($arg) eq 'ARRAY') ? "@$arg" : $arg || "");
       }
   
       push @{ $self->{$where} }, $args;
  
  
  
  1.4       +20 -1     modperl-2.0/Apache-Test/lib/Apache/TestConfigPerl.pm
  
  Index: TestConfigPerl.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfigPerl.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestConfigPerl.pm	2001/04/02 23:45:55	1.3
  +++ TestConfigPerl.pm	2001/04/03 00:26:58	1.4
  @@ -158,6 +158,10 @@
       $port;
   }
   
  +my %outside_container = map { $_, 1 } qw{
  +Alias AliasMatch AddType
  +};
  +
   #test .pm's can have configuration after the __DATA__ token
   sub add_module_config {
       my($self, $module, $args) = @_;
  @@ -170,7 +174,22 @@
       while (<$fh>) {
           next unless /\S+/;
           $self->replace;
  -        push @$args, split /\s+/, $_, 2;
  +        my($directive, $rest) = split /\s+/, $_, 2;
  +        if ($outside_container{$directive}) {
  +            $self->postamble($directive => $rest);
  +        }
  +        elsif ($directive =~ m/^<(\w+)/) {
  +            $self->postamble($directive => $rest);
  +            my $end = "</$1>";
  +            while (<$fh>) {
  +                $self->replace;
  +                $self->postamble($_);
  +                last if m:^\Q$end:;
  +            }
  +        }
  +        else {
  +            push @$args, $directive, $rest;
  +        }
       }
   }