hello,

I have multiple scripts running at the same time. Each scripts is running in its own windows command prompt instance.

I would like to have a master script that opens all the other scripts, and then collects the info from the other scripts.

I have been looking into using a piped open. The idea is to open each script from the master script with a statement like open JOB1, 'perl job1.pl|'. It kinda works except that I am having issues reading the data. I am trying to use IO::Select to know when there is data available to be read. I would be grateful if someone could look at my code and let me know if I am doing something wrong or if I am going about this the right way.

Thanks!

use IO::Select; my $read_set = new IO::Select(); #create handle set for reading open JOB1, 'perl test1.pl|' or die "cannot pipe to perl: $!"; open JOB2, 'perl test3.pl|' or die "cannot pipe to perl: $!"; my $read_set->add(JOB1); my $read_set->add(JOB2); while (1) { my $rh_set = IO::Select->select($read_set, undef, undef, 0); foreach my $rh (@$rh_set) { my $output = <$rh>; print $output2; print "in foreach $rh\n"; } } close JOB1; close JOB2;

In reply to communication between programs by earthfriendlyleaf

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.