Oh, yeah you're right. I said that wrong. What I meant was, how do I know if that interactive program (being called from a perl script) is waiting for user input or currently processing some other commands that require no user input but only requires the user to wait.

Does that make any sense? i'm not very articulate, am i?

If it is of any help, that interactive program is ClustalW (an alignment program), which requires several user input (from a character user interface), before it will finally produce the final output in file form. However, in the middle of the program, it requires the user to wait for some processing before allowing the user to type some more input at the prompt.

My current code:

my $infile = "homologene1.fa"; my $pid = open2(*Reader, *Writer, "clustalw") or die "Cant open clusta +lw: $!\n"; Writer->autoflush(); Reader->autoflush(); STDIN->autoflush(); print Writer "1\n"; print Writer "$infile\n"; print Writer "2\n"; print Writer "9\n"; print Writer "4\n"; print Writer "\n"; print Writer "\n"; print Writer "1\n"; print Writer "\n"; print Writer "\n"; print Writer "\n"; # <----- i need to wait here before making more user input print Writer "x\n"; print Writer "\n"; print Writer "x\n"; close(Writer); close(Reader); waitpid($pid, 0);

you can probably tell i'm very inexperienced.

thanks for reading.


In reply to Re^2: finding the status of the program being called from perl by Anonymous Monk
in thread finding the status of the program being called from perl by roseberry123

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.