httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: qw() and embedded spaces in filname paths
Date Fri, 16 Apr 2004 18:33:52 GMT
Geoffrey Young wrote:
> 
> Rodent of Unusual Size wrote:
> 
>>okey, bug found.  noticed on windows because spaces in filenames
>>are more common there, but it happens anywhere.
>>
>>here's the deal.  this command:
>>
>>perl Makefile.PL -httpd "C:/A B/apache.exe" -apxs "C:/A B/apxs"
>>
>>results in the following being put into t/TEST
>>
>>%Apache::testConfig::Argv = qw(httpd C:\A B\apache.exe apxs C:\A B\apxs)
>>
>>so, duh, the spaces lose their significance because qw() is treating
>>the whitespace as delimiters.
> 
> 
> does this help?
> 
> --Geoff
> 
> 
> ------------------------------------------------------------------------
> 
> Index: lib/Apache/TestMM.pm
> ===================================================================
> RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestMM.pm,v
> retrieving revision 1.32
> diff -u -r1.32 TestMM.pm
> --- lib/Apache/TestMM.pm	26 Mar 2004 01:17:08 -0000	1.32
> +++ lib/Apache/TestMM.pm	16 Apr 2004 14:56:45 -0000
> @@ -89,9 +89,11 @@
>      my $body = "BEGIN { eval { require blib; } }\n";
>  
>      $body .= Apache::TestConfig->modperl_2_inc_fixup;
> -
> -    if (@Apache::TestMM::Argv) {
> -        $body .= "\n\%Apache::TestConfig::Argv = qw(@Apache::TestMM::Argv);\n";
> + 
> +    foreach (@Apache::TestMM::Argv) {
> +        my ($key, $value) = @Apache::TestMM::Argv[0,1];
> +        $body .= "\n\$Apache::TestConfig::Argv{'$key'} = '$value';\n";
> +        splice(@Apache::TestMM::Argv,0,2)
>      }

or a simpler:

Index: lib/Apache/TestMM.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestMM.pm,v
retrieving revision 1.32
diff -u -r1.32 TestMM.pm
--- lib/Apache/TestMM.pm        26 Mar 2004 01:17:08 -0000      1.32
+++ lib/Apache/TestMM.pm        16 Apr 2004 18:28:28 -0000
@@ -91,7 +91,9 @@
      $body .= Apache::TestConfig->modperl_2_inc_fixup;

      if (@Apache::TestMM::Argv) {
-        $body .= "\n\%Apache::TestConfig::Argv = qw(@Apache::TestMM::Argv);\n";
+        $body .= "\n\%Apache::TestConfig::Argv = (" .
+            join( "," map qq["$_"], @Apache::TestMM::Argv) .
+            ");\n";
      }

      my $in = Symbol::gensym();

this patch simply quotes the arguments, leaving things as before. In case of 
Geoff's patch, it's simpler to write it as:

     if (@Apache::TestMM::Argv) {
         while (my ($k, $v) = splice @Apache::TestMM::Argv, 0, 2) {
             $body .= "\n\$Apache::TestConfig::Argv{'$key'} = '$value';\n";
         }
     }

Either way is fine with me.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Mime
View raw message