Well, the only reason I want to exec is because what I want to do in the child is contained in (several) separate scripts, which the daemon won't 'know' about in advance.

Also, I can't let the script just sit and wait for one script to finish before moving on to the next, as I may need to exec several scripts one after another, independently, and they could take some time to complete. So system()'ing them is out.

This leads to another problem.. Is there any way that you can distinguish which process/scripts last wrote to STDOUT or STDERR if I reopen those filehandles to a temporary filehandle or a scalar as an above monk posted?

Ideally, what I'd like to do is tell the children that are exec()'ing to call my logging function whenever their scripts print to STDOUT or STDERR. Is this even possible? I have a pretty specific logging format I need to conform to, and I'd like to be able to just call a function with the content of a print statement, and allow that function to handle formatting.

Thanks again for all of your help.


In reply to Re^2: Exec'ing and output by Anonymous Monk
in thread Exec'ing and output by Anonymous Monk

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.