Monks,

I'm currently writing a GUI to allow some of our non-technical guys to run some scripts and apps without having to delve into the depths of a console.

I need to trap the output from the scripts/apps so that we can report it to the user afterwards for error detection. I was using `` to do this:

# $cmd is defined earlier my $result = `$cmd 2>&1`;
but this doesn't work for some of the scripts (those that call external applications): they simply die saying they can't find the external command.

If I substitute the backticks for system, all works as expected.

I've tried playing with chdir to ensure the working directory is that of the script/app, but this doesn't make any difference at all: the command still dies.

Can anyone see what I'm doing wrong, and why the backticks cause a different system call than using system? I'm running Perl 5.004.04 on Sun Solaris.

Thanks in advance for your help.

-- Foxcub
#include www.liquidfusion.org.uk


In reply to Inconsistent system call from backticks vs system() by Tanalis

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.