I've been trying to write a script that controls an interactive command-line
program.  From the searching I've done, it looks like IPC::Open2/IPC::Open3
paired with Net::Telnet would be the easiest way to do this on Windows.  The
included script is my attempt, however I get the following error when I run
the script:

unexpected read error: Bad file descriptor at fcli.pl line 22

Any suggestions/comments appreciated.

James

 1 use strict;
 2 use warnings;
 3
 4 use IPC::Open2;
 5 use Net::Telnet;
 6 $| = 1;
 7
 8 my ($readme, $writeme, $results, $pid);
 9 eval { $pid = open2($readme, $writeme, 'flarecons', 'd', 'f', 'a'); };
10 if ($@) {
11     if ($@ =~ /^open2:/i) {
12         die "open2 failed: [EMAIL PROTECTED]";
13     }
14     die;
15 }
16
17 my $telnet = Net::Telnet->new(-fhopen => $readme,
18                               -telnetmode => 0,
19                               -cmd_remove_mode => 1,
20                               -prompt => '/fcli> $/');
21 print $writeme "l\n";
22 $results = $telnet->waitfor('/q\' to Quit\) $/');
23 print $writeme "\n";
24 $results .= $telnet->waitfor('/q\' to Quit\) $/');
25 print $writeme "q\n";
26 print $writeme "\cC\n";
27 waitpid($pid, 0);
28 print "$results\n";
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to