in reply to finding the status of the program being called from perl

is there a way to know if that interactive program is waiting for input or if it is currently executing?
If the program is waiting for input then it must be "currently executing". Are you trying not to start more than one instance of a program?

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

  • Comment on Re: finding the status of the program being called from perl

Replies are listed 'Best First'.
Re^2: finding the status of the program being called from perl
by Anonymous Monk on Jun 10, 2004 at 05:44 UTC

    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.