I loaded gcc 2.95.3 and resolved the cpp issue and so installed
Expect-1.13_08 & IO-Tty-0.97_01 successfully. The $exp->raw_pty(1) works
fine now. Thanks!
I'm still having a problem trying to "send" from inside a timeout condition:
code frag:
my $timeouts=0;
$exp->send("\n");
$exp->expect($timeout,
['OVL111', sub { my $fh = shift; $fh->send("login\n"); }],
['-ex','.', sub { my $fh = shift;
$fh->send("****\nlogo\n");exp_continue; }],
# ['SCH', sub { my $fh = shift;
$fh->send("****\nlogo\n");exp_continue; }],
# [timeout => sub {die "Timed out trying to login";}]
[timeout => sub { $timeouts++; if($timeouts < 5)
{my $fh = shift; $fh->send("****\nlogo\n");exp_continue; }
else { die "Timed out trying to clear loging";}
}]
);
results in:
TIMEOUT
Calling timeout function ARRAY(0x3831fc)...
Can't call method "send" on unblessed reference at get_pbx_routes.pl line
166.
line 166 is the timeout in the code above
=================
This is the original Expect script code that I'm trying to mimic:
send -- "\r"
expect {
timeout {send_error "System still logged in-sending
logout\n"; send "****\rlogo\r"}
"." {send_error "System still logged in-sending
logout\n"; send "****\rlogo\r"}
"OVL111"
}
send -- "login\r"
-----Original Message-----
From: Sorrell, Al
Sent: Thursday, February 28, 2002 11:54 AM
To: 'RGi...@cp...'
Subject: RE: [Expectperl-discuss] does timeout => sub{} pass filehandle?
Thanks for the new material.
1) In trying to perl Makefile.PL, I'm running into a problem. Looks like you
changed from 'cc' to 'cpp'. Is cpp really needed, and if so what version
(I'm assuming that's gcc's C++ compiler). I currently have 2.8.1 installed,
which creates a c++
2) I really was trying to match "." - this app is going to the console of a
Nortel Meridian PBX via a router's AUX port and the logged-in prompt for
this thing is "."
Thanks,
Al
-----Original Message-----
From: RGi...@a1... [mailto:RGi...@a1...]
Sent: Thursday, February 28, 2002 5:23 AM
To: Sorrell, Al
Cc: 'exp...@li...'
Subject: Re: [Expectperl-discuss] does timeout => sub{} pass filehandle?
> Solaris 2.6 Expect 1.12
> In all the examples, when a timeout is encountered you simply die();
> In my case, a device can get into a state where what is returned is
> unpredictable. There is a specific sequence that I can then send
> to log out the previous action and get back to a known state.
> However, the code below doesn't seem to work correctly
> $exp->expect($timeout,
> ['OVL111', sub { my $fh = shift; $fh->send("login\n"); }],
> ['\.', sub { my $fh = shift; $fh-
> >send("****\nlogo\n");exp_continue;}],
Are you matching for a dot here?
> [timeout => sub { my $fh = shift;
> $fh->send("****\nlogo\n");exp_continue; }]
> );
exp_continue for timeout only started working a few beta versions ago.
> Using a regex of '.*' would be another way - but risky -
> especially until I can get "raw" working. Any suggestions?
I'm attaching the latest version, much improved and almost ready for
release (I still need a few test results for IO-Tty, especially on
HPUX, OSF and SCO). Please try it (be sure to browse the docs for all
the new features) and tell me if it solves your problems.
Thanks!
Roland
--
RGi...@cp...
|