Thank you, everyone, for very enlightening answers, I've learned quite a few things from them.
Unfortunately, ShellQuote::Any::Tiny doesn't do it right:
>perl -MShellQuote::Any::Tiny=shell_quote -E "system $^X, '-E', 'say f +or @ARGV; <STDIN>', 1, shell_quote(qq(\x5c \x5c)), 2" 1 \\ \ 2
because it escapes every backslash. But only terminating one, which precedes the closing double-quote (if any), should be escaped -- as follows from "Everyone quotes command line arguments the wrong way".
Win32::ShellQuote appears to handle everything correctly.
Actually, I lived happily before this, relying only on Perl's built-in ability to double-quote arguments, which contain spaces. Until someone, in her wisdom, decided that a double-quote in the middle of template name, to be passed as argument to another script, is a good idea.
In reply to Re^2: Having to manually escape quote character in args to "system"?
by vr
in thread Having to manually escape quote character in args to "system"?
by vr
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |