in reply to Re^4: Construct command portable way
in thread Construct command portable way

In IPC::Exe, I do the following:
# non-Unix: escape command so that it feels Unix-like my @cmd = $non_unix ? map { (my $x = $_) =~ s/(\\"|")/$1 eq '"' ? '\\"' : '\\\\\\"'/ge; qq("$x"); } @_ : @_;

before exec { $cmd[0] } @cmd; (See the quoting: test in t/02_IPC-Exe.t)

This helps to get around most of the quoting issues under Win32.

Replies are listed 'Best First'.
Re^6: Construct command portable way
by parv (Parson) on May 08, 2009 at 01:35 UTC

    This thread about quoting issues reminds me why I use perl (mainly for direct command line use) instead of sed for I, well, rather not deal with quoting issues (on a Unix-like system in bourne like (z)shell).

    My impending doom awaits on the other side.