Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: finding the status of the program being called from perl

by matija (Priest)
on Jun 10, 2004 at 05:25 UTC ( [id://362982]=note: print w/replies, xml ) Need Help??


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

You could run select on the filehandle you use to communicate with the interactive program. If it returns before the timeout, and marks the filehandle as ready for input, then the program is waiting for you to send it data. If it doesn't, it isn't.
  • 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 roseberry123 (Acolyte) on Jun 10, 2004 at 07:28 UTC

    thanks. i think this is what i am looking for. but i'm getting really confused. besides perldoc.com, do you know where i can find more information about whether i should choose $sel->can_read or $sel->can_write? i think my perl script is becoming really confused, because what used to work is now not working anymore. and also, if i am using open2(*Reader, *Writer, $cmd), which filehandle, Reader or Writer, should i use to find out whether the interactive program is waiting for input? or do i use STDIN?

    thanks very much. i really appreciate it.

      You should choose $sel->can_read for the file handle you are reading from (i.e. the filehandle that the other process is writing to).

      The filehandle you should test to see if the other program is waiting to read is the filehandle you write to.

        matija, thank you.

        but it's not working. i think it's more complicated than it sounds? i mean, using IO::Select. are we supposed to go into a while loop? too confusing.

        but not all hopeless, i think i found another solution. i think i will try bioperl.

        anything you want to do, if you search long enough, you will find someone else has already done it.

        thanks anyway. take care. see you.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://362982]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-23 13:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found