[Module-build-checkins] Module-Build/lib/Module/Build/Platform Windows.pm,1.17,1.18
Status: Beta
Brought to you by:
kwilliams
From: Randy W. S. <si...@us...> - 2004-11-13 09:30:57
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build/Platform In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20706/lib/Module/Build/Platform Modified Files: Windows.pm Log Message: Updated split_like_shell() on Win32 platform to behave more like the native shells (command.com and cmd.exe) with regards to quoting and escape characters. Index: Windows.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Platform/Windows.pm,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Windows.pm 5 Nov 2004 01:51:55 -0000 1.17 --- Windows.pm 13 Nov 2004 09:30:47 -0000 1.18 *************** *** 69,84 **** sub split_like_shell { ! # In Win32 command shells, the backslashes in the string "\bar\baz" ! # should be preserved, because they often show up as parts of ! # pathnames. We double-up all these backslashes so shellwords() can ! # still be used (making sure to avoid backslash-quote pairs, which ! # should work the same as on Unix) ! (my $self, local $_) = @_; ! if (defined() && length() && !ref()) { ! s/\\(?!")/\\\\/g; } ! return $self->SUPER::split_like_shell($_); } --- 69,105 ---- sub split_like_shell { ! my $self = shift; ! local $_ = shift; ! my @argv; ! return @argv unless defined; ! return @$_ if UNIVERSAL::isa($_, 'ARRAY'); ! s/^\s+|\s+$//g; ! return @argv unless length; ! ! push @argv, ''; ! my $quote_mode = 0; ! ! while (length()) { ! if ( s/^\\(\"|\\)// ) { ! $argv[-1] .= $1; ! ! } elsif ( $quote_mode && s/^""// ) { ! $quote_mode = 0; ! $argv[-1] .= '"'; ! ! } elsif ( s/^\"// ) { ! $quote_mode = !$quote_mode; ! ! } elsif ( !$quote_mode && s/^\s+// ) { ! push @argv, ''; ! ! } else { ! s/^(.)//; ! $argv[-1] .= $1; ! } } ! return @argv; } |