I'm writing a server using PERL (I'm running a Windows XP system). It needs to write some data to the an external console application and capture and process it's output. I looked through the web and found the IPC::Run module. It seemed to be, what I needed. At first I wrote a test program like that -
use IPC::Run qw(start pump finish); my @args; push @args, $app_path; my ($in, $out, $err); # starting the application my $handle = start \@args, \$in, \$out, \$err; # wait until prompted for input pump $handle until $out =~ /Login:/; $in .= "Boris\n"; # wait until prompted for password pump $handle until $out =~ /Password:/; # and so on ...
This script worked fine. But I needed to store the $in $out and $handle variables for further use. So I put them in the hash
$client_descr->{"Handle"} = $handle; $client_descr->{"In"} = $in; $client_descr->{"Out"} = $out; $client_descr->{"Err"} = $err;
But after that I had problems: From other sub I got $in $ out and $handle
my ($handle, $in, $out) = ($client_descr->{"Handle"}, $client_descr->{ +"In"}, $client_descr->{"Out"});
But I had problems - here in this pump loop nothing seemed to happed. This pump loop was just locked.
$in .= "new data\n"; pump $handle until $out =~ /data arrived:/; print $out;
Is it true, that I can use IPC::Run only in one module? And are there any other solutions of my problem? I tried to ise Open2, but it doesn't seem to be working.

In reply to Problems with IPC::Run module on Windows XP by laoboss

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.