Here is a version using Text::ParseWords and a modified spawn subroutine, which uses exec in scalar context.
I think that was an extremely bad move, because now you have to worry about shell metacharacters in arguments, which you formerly did not. For example, consider:
runN echo '*'
We are expecting this to run one echo to print out a star, but with your implementation, it does not; the quotes are stripped off and it echoes a list of the filenames in the current directory.

Similarly, suppose a file in the current directory is named foo bar. Then runN command * will run the command not with the argument foo bar but with the two arguments foo and bar.

Now let's suppose there is a file in the current directory named `rm -rf /`. (Note backquotes!) Then running your version of runN command * will erase the entire filesystem.

I wrote a blog entry about the perils of multiple shell evaluation in this context. I said:

My fear was that by introducing a double set of shell-like interpretation, I'd be opening a horrible can of escape character worms and weird errors, and my hope was that if I ignored the issue the problems might be simpler, and might never arise in practice.
This is exactly the sort of thing I was worried about. Your implementation certainly proves that I was correct about at least the first part of this prediction!


In reply to Re^4: Parallelization of heterogenous (runs itself Fortran executables) code by Dominus
in thread Parallelization of heterogenous (runs itself Fortran executables) code by Jochen

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.