You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Stas Bekman <st...@stason.org> on 2002/01/18 05:36:42 UTC

[patch] preserve spaces

any reason for this leading space stripping? If we have a vh block with 
many nested blocks it's nice to preserve the indentation, no? Unless 
this was done for a special reason, this patch keeps the config block as is.

Index: Apache-Test/lib/Apache/TestConfigPerl.pm
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm,v
retrieving revision 1.44
diff -u -r1.44 TestConfigPerl.pm
--- Apache-Test/lib/Apache/TestConfigPerl.pm	14 Jan 2002 06:44:10 -0000	
1.44
+++ Apache-Test/lib/Apache/TestConfigPerl.pm	18 Jan 2002 04:32:23 -0000
@@ -232,7 +232,6 @@
              my $end = "</$1>";
              while (<$fh>) {
                  chomp;
-                s/^\s+//;
                  $self->replace;
                  $self->postamble($_);
                  last if m:^\Q$end:;


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Re: [patch] preserve spaces

Posted by Stas Bekman <st...@stason.org>.
Doug MacEachern wrote:

> On Fri, 18 Jan 2002, Stas Bekman wrote:

 >

>>any reason for this leading space stripping? If we have a vh block with 
>>many nested blocks it's nice to preserve the indentation, no? Unless 
>>this was done for a special reason, this patch keeps the config block as is.
> 
> that'll break all of the pattern matches, eq's, etc. on $directive that
> follow.

Not really, since this is inside the block that gets copied as is, not 
on the top level. There is only one regex. Here I've added ^\s* just in 
case the closing directive is not starting at the beginning of the line.


Index: Apache-Test/lib/Apache/TestConfigPerl.pm
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm,v
retrieving revision 1.45
diff -u -r1.45 TestConfigPerl.pm
--- Apache-Test/lib/Apache/TestConfigPerl.pm	21 Jan 2002 02:13:55 -0000	
1.45
+++ Apache-Test/lib/Apache/TestConfigPerl.pm	21 Jan 2002 02:19:47 -0000
@@ -237,10 +237,9 @@
              my $end = "</$1>";
              while (<$fh>) {
                  chomp;
-                s/^\s+//;
                  $self->replace;
                  $self->postamble($_);
-                last if m:^\Q$end:;
+                last if m:^\s*\Q$end:;
              }
          }
          else {


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Re: [patch] preserve spaces

Posted by Doug MacEachern <do...@covalent.net>.
On Fri, 18 Jan 2002, Stas Bekman wrote:

> any reason for this leading space stripping? If we have a vh block with 
> many nested blocks it's nice to preserve the indentation, no? Unless 
> this was done for a special reason, this patch keeps the config block as is.

that'll break all of the pattern matches, eq's, etc. on $directive that
follow.