Author: kwilliams Date: Wed Jan 30 19:12:36 2008 New Revision: 10673 Modified: ExtUtils-CBuilder/trunk/Changes ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Platform/Windows.pm
Log: Turn split_like_shell() into a near-no-op on Windows, which is probably more accurate Modified: ExtUtils-CBuilder/trunk/Changes ============================================================================== --- ExtUtils-CBuilder/trunk/Changes (original) +++ ExtUtils-CBuilder/trunk/Changes Wed Jan 30 19:12:36 2008 @@ -1,5 +1,10 @@ Revision history for Perl extension ExtUtils::CBuilder. + - Replaced the split_like_shell() method on Windows with a + near-no-op, which is probably more correct and has the benefit of + not messing up UNC paths. [John R. LoVerso, see + http://rt.cpan.org/Ticket/Display.html?id=26545] + - Fixed extra_compiler_flags on Windows, they were being ignored. [Robert May] Modified: ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Platform/Windows.pm ============================================================================== --- ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Platform/Windows.pm (original) +++ ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Platform/Windows.pm Wed Jan 30 19:12:36 2008 @@ -33,61 +33,14 @@ } sub split_like_shell { - # As it turns out, Windows command-parsing is very different from - # Unix command-parsing. Double-quotes mean different things, - # backslashes don't necessarily mean escapes, and so on. So we - # can't use Text::ParseWords::shellwords() to break a command string - # into words. The algorithm below was bashed out by Randy and Ken - # (mostly Randy), and there are a lot of regression tests, so we - # should feel free to adjust if desired. - + # Since Windows will pass the whole command string (not an argument + # array) to the target program and make the program parse it itself, + # we don't actually need to do any processing here. (my $self, local $_) = @_; return @$_ if defined() && UNIVERSAL::isa($_, 'ARRAY'); - - my @argv; - return @argv unless defined() && length(); - - my $arg = ''; - my( $i, $quote_mode ) = ( 0, 0 ); - - while ( $i < length() ) { - - my $ch = substr( $_, $i , 1 ); - my $next_ch = substr( $_, $i+1, 1 ); - - if ( $ch eq '\\' && $next_ch eq '"' ) { - $arg .= '"'; - $i++; - } elsif ( $ch eq '\\' && $next_ch eq '\\' ) { - $arg .= '\\'; - $i++; - } elsif ( $ch eq '"' && $next_ch eq '"' && $quote_mode ) { - $quote_mode = !$quote_mode; - $arg .= '"'; - $i++; - } elsif ( $ch eq '"' && $next_ch eq '"' && !$quote_mode && - ( $i + 2 == length() || - substr( $_, $i + 2, 1 ) eq ' ' ) - ) { # for cases like: a"" => [ 'a' ] - push( @argv, $arg ); - $arg = ''; - $i += 2; - } elsif ( $ch eq '"' ) { - $quote_mode = !$quote_mode; - } elsif ( $ch eq ' ' && !$quote_mode ) { - push( @argv, $arg ) if $arg; - $arg = ''; - ++$i while substr( $_, $i + 1, 1 ) eq ' '; - } else { - $arg .= $ch; - } - - $i++; - } - - push( @argv, $arg ) if defined( $arg ) && length( $arg ); - return @argv; + return unless defined() && length(); + return ($_); } sub arg_defines {
