The Expect module mentioned above is the usually best approach for working with interactive processes. It is well designed for dealing with interactive processes, handling deadlocks and situations where you have some input that is expected, an unexpected error, or nothing at all returns.
Another way to work with interactive processes is IPC::Open2. Using IPC::Open2 will give you a read and a write handle to a process. It should be included as a standard module, so it does not require installing a new module. But using it can degenerate quickly if you get unexpected errors or no output from a program, so you need to program carefully to avoid deadlocks. I would recommend you use Expect if at all possible.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|