Hi Monks.

I have some code I'm trying to port from *nix to Windows and am stumbling over Windows long names. I've scoured the web and see many references to this, but none have helped.

Here's what I'm trying to do...

my $progPath = cwd(); my $perlPath = $^X; my $args = "-c abc.conf -r"; # then build the command and capture the output... my $output = `$perlPath $progPath/my.pl $args`;
Both the perl and program paths are in "Program Files", so it's tripping over the spaces.

I need to capture the output. I've tried backticks, capture(), qx{}. I've tried many permutations of quotes, escaped quotes, q{}, qq{}, etc. with no luck.

I know I could make it work by converting the paths to Windows 8.3 names.

I'm asking:

1) is it wise to just go ahead and use the 8.3 name and be done with it?

2) is there a way to make this work without doing that and is that the wiser route?

Thanks, Rick


In reply to Executing perl program from another perl program and capturing the output by rgren925

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.