Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^5: Problem with 'system' function in Windows Vista (escape quote)

by tye (Sage)
on Mar 20, 2007 at 23:49 UTC ( #605769=note: print w/replies, xml ) Need Help??

in reply to Re^4: Problem with 'system' function in Windows Vista
in thread Problem with 'system' function in Windows Vista

The documented MS C RTL quoting rules (that not all Win32 programs follow, unfortunately) say that to get <bar " baz> you should write <"bar \" baz">. The implementation is a bit weird, especially if you don't follow those rules. But your case doesn't work for me:

C:\> perl -le"print '<',$_,'>' for @ARGV" "foo "" bar" <foo "> <bar> C:\>

Note that \ only "escapes" when in a construct matching /\\+"/ (an even number of backslases results in $n-1 backslashes, an odd number in $n-1 backslashes followed by a quote).

This pointed out a subtle bug in the "current" Perl quoting that is done:

system( $^X, '"-leprint qq(<$_>) for @ARGV"', "\\root\\subdir\\", "\\root dir\\sub dir\\", ); produces: <\root\subdir\> <\root dir\sub dir">

The fact that I had to quote and be careful with that second argument is the not-subtle short-coming. But the fix for it also fixes the final \ turning into a ".

- tye        

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://605769]
[erix]: didn't Sybase have pretty good auditing? :) (this is a vague memory)
[erix]: (culprits often are upstream of db of course)
[Corion]: Ah, how I missed it. After some years, I revisit slashdot on a click-bait link, and it provides the usual humor instantly: "I didn't know Drupal had rules for sex. It must be a plug-in"
[Corion]: erix: This is not for sybase, but for the input data files, resp. their contents.

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2017-03-28 09:03 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (328 votes). Check out past polls.