Not sure if this is a big help to you, but you can use the return code of the child processes to communicate with the parent process. I did that in this case:

$pm->run_on_finish( sub { my ($pid, $exit_code, $ident) = @_; $connected_server_count += $exit_code; $progress = ($count / $total_server_count) * 100; printf "Progress: %4.1f\%\r",$progress; $count++; } );
Example of a bad (0) return:
$pm->finish(0); # Couldn't connect to this one, skip to next server in + main loop
Example of a good (1) return:
# Close ssh connection to this server $ssh->close(); $pm->finish(1);

The point being that $count kept track of how many servers were processed ($connected_server_count is used elsewhere) but it based that count on the return code. In this code, a server returned 0 if it could not connect, but returned 1 if it could, so I just summed those values. I've not played around with it, but I assume you can map out any numeric code to suit your purposes, perhaps the number of days, etc.


In reply to Re^3: Creating a hash within a fork by sierpinski
in thread Creating a hash within a fork by edimusrex

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.