Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^5: Construct command portable way

by repellent (Priest)
on May 07, 2009 at 20:32 UTC ( [id://762686]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://762686]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-18 00:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found