Expect-1.12_ref_004 
Author Message
 Expect-1.12_ref_004

Hello,

Here I try to do the same as in Expect-1.12_ref_003
But with "interconnect".
It does not work at all !!!
I will rerererereread the man.
Or maybe you will find the solution and post it in this newsgroup ?

See you in my next mail  (...ref_005)
Pierre.

#!/usr/bin/perl -w
use strict;
use Expect;
use Term::ANSIColor qw(:constants);   # just for the fun
 $Term::ANSIColor::AUTORESET = 1;

#################
# linux (Debian) + Expect-1.12
#
# You need the file data in order to run this  (see below)
# In this example I will spawn a single process and handle the ouput
# of this process
# Everything is going fine
#################

my ($pid,$pod);
my $start=time;

system("/usr/bin/clear");
print "Expect_version: ",Expect::version(undef),"\n";
print "Perl_version  : $]\n";

#  now I would like to play with this stuff !!
$pid=Expect->spawn("/bin/cat","data") or die ";can't spawn\n";
$pod=Expect->spawn("/bin/grep","DATA") or die "can't spawn\n";
$pid->exp_internal(1); # turn debugging ON
$pod->exp_internal(1);
$Expect::Multiline_Matching = 1;

$pid->set_group($pod); # So $pod should listen to $pid. Is it correct ??
Expect::interconnect($pid,$pod);   # as in the example B.top

print "\nstart_time: $start\n";;
print "end_time: ",time,"\n";
print "elapsed_time: ",time - $start,"\n";
print BOLD RED "Out_of_expect\n";
#end_of_script

###   input file needed for the exercice  :-)  Have fun
#10316 B    1713 FFFF_0003 FFFF_9D04 0C00 4820 .... 0080:0001 002A DUP
20:56:56.2
#           DATA 0300 5C7F
#           UBUF 0108 0549 04A1 9003 A390 0118 1E89 8202
#           UBUF 6C83 010C 3083 3230 3234 3636 3731 7038
#           UBUF A109 3232 3230 3332 3132
##  this only noise
#10321 B    1713 FFFF_9D04 FFFF_9D05 0C00 4820 .... 0080:0002 0007 DUP
20:56:56.5
#           DATA 0300 FF50
#           UBUF 0108 01C9
#10321 B    1713 FFFF_9D04 FFFF_9D05 0C00 4820 .... 0080:0003 0007 DUP
20:56:56.5
#           DATA 0300 0060
#           UBUF 0108 01C9 0118 XX89
#10321 B    1713 FFFF_9D04 FFFF_9D05 0C00 4820 .... 0080:0004 0007 DUP
20:56:56.6
#           DATA 0300 FF61
#           UBUF 0108 01C9 0118 XX89
#
#10315 B    1713 FFFF_0003 FFFF_9D04 0C00 4820 .... 0080:0005 0008 DUP
20:57:00.4
#           DATA 0300 5C50
#           UBUF 0108 4D49 0208 9F84
##  this only noise
#
#10315 B    1713 FFFF_0003 FFFF_9D04 0C00 4820 .... 0080:0006 0008 DUP
20:57:00.4
#           DATA 0300 5C60
#           UBUF 0108 4D49 0208 9F84
#10321 B    1713 FFFF_9D04 FFFF_9D05 0C00 4820 .... 0080:0007 0004 DUP
20:57:00.4
#           DATA 0300 0050
#           UBUF 0108 5AC9
#10315 B    1713 FFFF_0003 FFFF_9D04 0C00 4820 .... 0080:0008 0008 DUP
20:57:00.4
#           DATA 0300 2461
#           UBUF 0108 4D49 0208 9F84
#10321 B    1713 FFFF_9D04 FFFF_9D05 0C00 4820 .... 0080:0009 0004 DUP
20:57:00.4
#           DATA 0300 FF60
#           UBUF 0108 5AC9
#10321 B    1713 FFFF_9D04 FFFF_9D05 0C00 4820 .... 0080:000A 0004 DUP
20:57:00.5
#           DATA 0300 FF61
#           UBUF 0108 5AC9
#
#10316 B    1713 FFFF_0003 FFFF_9D04 0C00 4820 .... 0080:000B 002A DUP
20:57:08.8
#           DATA 0300 FF7F
#           UBUF 0108 054F 04A1 9003 A390 0118 1E89 8202
#           UBUF 6C83 010C 3083 3230 3234 3636 3731 7038
#           UBUF A109 3232 3230 3332 3132
##  this only noise
#10321 B    1713 FFFF_9D04 FFFF_9D05 0C00 4820 .... 0080:000C 0007 DUP
20:57:08.9
#           DATA 0300 FF60
#           UBUF 0108 01CF 0118 XX89
#10321 B    1713 FFFF_9D04 FFFF_9D05 0C00 4820 .... 0080:000D 0007 DUP
20:57:08.9
#           DATA 0300 FF61
#           UBUF 0108 01CF 0118 XX89
#10321 B    1713 FFFF_9D04 FFFF_9D05 0C00 4820 .... 0080:000E 0004 DUP
20:57:08.9
#           DATA 0300 FF50
#           UBUF 0108 01CF
#
#10315 B    1713 FFFF_0003 FFFF_9D04 0C00 4820 .... 0080:000F 0008 DUP
20:57:13.9
#           DATA 0300 5C60
#           UBUF 0108 4D4F 0208 9F84
##  this only noise
##  this only noise



Tue, 20 Apr 2004 02:20:03 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. expect in perl [Was expect: How to use interact]

2. Using Expect to telnet to port 80 (not Expect::Simple)

3. Expect.pm not performing as expected

4. failed open in W2K doesn't pass flow of control as expected

5. finding text chat'expect did't match

6. perl and tcl/tk/expect papers available

7. IO::Expect needs IO::Pty?

8. Expect.pm and HPUX 10.20

9. IO::Expect

10. Can Perl control modem comm like expect/tcl

11. problems with Expect.pm v1.04

12. Expect.pm: broken process and EOF problems

 

 
Powered by phpBB® Forum Software