UPDATE3 : SORRY, I HAVE JUST REALISED THAT THE FILES EXIST, EXCEPT THEY ARE IN SOME CHILD DIRECTORIES. SO THERE IS NO PROBLEM ANY MORE.

Hello Deak Monks

I would like to get the errors which concern a certain script (here prog2.pl) in my program, which is composed of several scripts, like:

my $cmd1 = "perl prog1.pl"; system($cmd1); my $cmd2 = "perl prog2.pl"; system($cmd2); my $cmd3 = "perl prog3.pl"; system($cmd3);

So for the script concerned (prog2.pl for example) , I write:

BEGIN { open(STDERR, ">stderr2.log") or die "Failed to open log file"; }

Then I write

close STDERR;

So that each time I invoke my script, it write only the errors for this part. However at the end, I have nothing. Could you explain ? Thanks

update: I erased the term subscript, as it was too ambiguous. update2 : just as cdarke said, what I called "subscript" meant another script being called as a child process. Sorry for the ambiguity. UPDATE3 : SORRY, I HAVE JUST REALISED THAT THE FILES EXIST, EXCEPT THEY ARE IN SOME CHILD DIRECTORIES. SO THERE IS NO PROBLEM ANY MORE.


In reply to get the errors only for a part of the program by steph_bow

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.