Re: [Module::Build] ./Build on Win98
Status: Beta
Brought to you by:
kwilliams
|
From: David G. <da...@hy...> - 2006-03-01 03:31:59
|
Randy W. Sims wrote:
>>> Otherwise, I'm not sure how to quote the percent symbol (%%* doesn't
>>> work). I've posted a message over on alt.msdos.batch about this.
>>
>> Won't the multi-argument form of system() be helpful here? It's
>> generally much easier to get that to work out than trying to get
>> quoting right.
>
> It doesn't seem so... In order to use redirection in the command that's
> executed, the shell must be invoked. If you use the multiple arg form of
> system, you have to explicitly specify the shell. The problem is the
> shell then requires the syntax:
>
> $shell /C "$string"
I've been deleting this thread for a while for lack of time to read it,
but caught up briefly here. I apologize if this has been discussed
already or you're well beyond it, but Roderich Schupp and I had a short
exchange a while ago about windows shell quoting in discussing
improvement to IPC::Run3. In short, we concluded it's really ugly. By
triangulating between Perl, Haskell and gtk/glib source and comments, he
came up with the following escaping algorithm:
sub protect_argv_string
{
my ($p) = @_;
(my $q = $p) =~ s/(\\*)"/$1$1\\"/g;
$q = qq["$q"] if $p =~ /[ \t]/;
return $q;
}
That said, I don't think we ever came up with a way of properly escaping
"%". You can precede it with a backslash it to prevent it from being
interpreted as an environment variable, but the backslash itself appears
in the output.
Regards,
David
|