Wow. Today really seems to be my day for talking past people. Maybe I should stop posting any more today -- there must be something in the air.

Nice straw man. I didn't advocate changing system($line)

Going way back in the thread, I'd suggested 'if only one argument is provided, we have to assume the user provided a valid command line on the current platform', from which you quoted the 'assume...' part and said '...I strongly disagree'. That's what prompted my response.

To use a co-worker's term, I think you, me and BrowserUK are in violent agreement that system(@list) on win32 should be fixed to quote the initial argument, but that system($line) is up to the user to do the right thing.

As a minor note, my suggestion about documenting a recommendation of double quotes was only for the system($line) form, like so:

if ( $^O =~ /Win32/ ) { system( qq{"$yourEditor" "$filename"} ); }

There should be a general warning in docs for the system($line) form about making assumptions about spaces in filenames. On linux, they can be escaped with backslashes. On Win32, each argument that might have spaces needs to be wrapped in quotes. And so on.

Generally, I think people should be encouraged to use system(@list) unless they really need to depend on the shell for something (e.g. file redirection).

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.


In reply to Re^10: Poll: Is your $^X an absolute path? (system @list) by xdg
in thread Poll: Is your $^X an absolute path? by xdg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.