Hello wise monks,

I come here seeking wisdom as to why backticks (I know, only use them if I have to) are not playing nicely with my script when it is run through the web. If I run my script through a terminal, it works beautifully, but when I try to run it remotely from a web server it barely does anything.

So the reason I am using backticks is I am automating testing of my script, and I want to know what the result of each run of my script is (what STDERR and STDOUT is generated). As far as I know, backticks are the best way to go about this (correct me if I am wrong though).

This is the code I am using to test my script:

`dashboard.pl --source $_ 1>&2`;

Yes, the path is relative. This is because both the scripts are in the same directory. I have also tried giving the absolute path (/u/alexandg/web/dashboard.pl) and it also was to no avail. The "--source $_" is the argument I use to pass in the test case. I am 100% sure this is not the issue.

The trouble is when I run this same command from the web server, nothing is reported back to the script. Granted I am not checking the return of the backticks, because I want them to ALWAYS continue no matter what happens. If the script I am testing crashes, thats OK, just report it and move onto the next test case.

All of these cases are stored inside of a while loop, and I am iterating over <$FILE> for test cases.

The questions I have are why doesn't this work from the web server, and how can I get it to function from both the command line and from the web?

Thank you!


In reply to CGI and Backticks by agronbach

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.