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 go...@apache.org on 2006/07/17 20:03:02 UTC

svn commit: r422774 - in /perl/modperl/trunk: Changes lib/Apache2/PerlSections.pm t/conf/extra.last.conf.in t/response/TestDirective/perldo.pm

Author: gozer
Date: Mon Jul 17 11:03:02 2006
New Revision: 422774

URL: http://svn.apache.org/viewvc?rev=422774&view=rev
Log:
Multi-line $PerlConfig used to throw errors instead of being
split on '\n'

Reported-By: Andreas J. Koenig


Modified:
    perl/modperl/trunk/Changes
    perl/modperl/trunk/lib/Apache2/PerlSections.pm
    perl/modperl/trunk/t/conf/extra.last.conf.in
    perl/modperl/trunk/t/response/TestDirective/perldo.pm

Modified: perl/modperl/trunk/Changes
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/Changes?rev=422774&r1=422773&r2=422774&view=diff
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Mon Jul 17 11:03:02 2006
@@ -12,6 +12,8 @@
 
 =item 2.0.3-dev
 
+Multi-line $PerlConfig is now working [Gozer]
+
 PerlOptions None was previously incorrectly reported as invalid
 inside <VirtualHost> or <Directory> blocks.
 [Philip M. Gollucci]

Modified: perl/modperl/trunk/lib/Apache2/PerlSections.pm
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/lib/Apache2/PerlSections.pm?rev=422774&r1=422773&r2=422774&view=diff
==============================================================================
--- perl/modperl/trunk/lib/Apache2/PerlSections.pm (original)
+++ perl/modperl/trunk/lib/Apache2/PerlSections.pm Mon Jul 17 11:03:02 2006
@@ -65,8 +65,11 @@
     {
         no strict 'refs';
         foreach my $package ($self->package) {
-            $self->dump_special(${"${package}::$special"},
-              @{"${package}::$special"} );
+            my @config = map { split /\n/ } 
+                            grep { defined } 
+                                (@{"${package}::$special"}, 
+                                 ${"${package}::$special"});
+            $self->dump_special(@config);
         }
     }
 
@@ -193,10 +196,12 @@
 }
 
 sub add_config {
-    my ($self, $config) = @_;
-    return unless defined $config;
-    chomp($config);
-    push @{ $self->directives }, $config;
+    my ($self, @config) = @_;
+    foreach my $config (@config) {
+        return unless defined $config;
+        chomp($config);
+        push @{ $self->directives }, $config;
+    }
 }
 
 sub post_config {

Modified: perl/modperl/trunk/t/conf/extra.last.conf.in
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/t/conf/extra.last.conf.in?rev=422774&r1=422773&r2=422774&view=diff
==============================================================================
--- perl/modperl/trunk/t/conf/extra.last.conf.in (original)
+++ perl/modperl/trunk/t/conf/extra.last.conf.in Mon Jul 17 11:03:02 2006
@@ -111,3 +111,23 @@
    Perl 1
 </VirtualHost>
 </IfDefine>
+
+#Single-line $PerlConfig
+<Perl>
+  $PerlConfig = "Alias /perl_sections_perlconfig_scalar @DocumentRoot@";
+</Perl>
+
+#Multi-line $PerlConfig
+<Perl>
+  $PerlConfig = "Alias /perl_sections_perlconfig_scalar1 @DocumentRoot@
+                 Alias /perl_sections_perlconfig_scalar2 @DocumentRoot@
+                ";
+</Perl>
+
+#@PerlConfig
+<Perl>
+  @PerlConfig = ("Alias /perl_sections_perlconfig_array1 @DocumentRoot@",
+                 "Alias /perl_sections_perlconfig_array2 @DocumentRoot@",
+                );
+</Perl>
+

Modified: perl/modperl/trunk/t/response/TestDirective/perldo.pm
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/t/response/TestDirective/perldo.pm?rev=422774&r1=422773&r2=422774&view=diff
==============================================================================
--- perl/modperl/trunk/t/response/TestDirective/perldo.pm (original)
+++ perl/modperl/trunk/t/response/TestDirective/perldo.pm Mon Jul 17 11:03:02 2006
@@ -4,6 +4,7 @@
 use warnings FATAL => 'all';
 
 use Apache::Test;
+use Apache::TestRequest;
 use Apache::TestUtil;
 use Apache2::Const -compile => 'OK';
 use Apache2::PerlSections;
@@ -11,7 +12,7 @@
 sub handler {
     my $r = shift;
 
-    plan $r, tests => 17;
+    plan $r, tests => 22;
 
     ok t_cmp('yes', $TestDirective::perl::worked);
 
@@ -57,6 +58,16 @@
     my $bport = $TestDirective::perl::base_server->port;
     my $vport = $TestDirective::perl::vhost_server->port;
     ok defined $bport && defined $vport && $vport != $bport;
+    
+    foreach my $url (qw(scalar scalar1 scalar2)) {
+        my $res = GET "/perl_sections_perlconfig_$url/";
+        ok t_cmp($res->is_success, 1, '$PerlConfig');
+    }
+    
+    foreach my $url (qw(array1 array2)) {
+        my $res = GET "/perl_sections_perlconfig_$url/";
+        ok t_cmp($res->is_success, 1, '@PerlConfig');
+    }
     
     Apache2::Const::OK;
 }