The logfile output looks like:-#!/usr/bin/perl -w use strict; use Expect; use Data::Dumper; my $timeout = '20'; my $user_ts = '192.10.1.1 8000'; my $user_ts_user = 'username'; my $user_ts_pass = 'password'; my $exp; $exp = Expect->spawn("telnet $user_ts") or die "Cannot spawn teln +et: $!\n"; my $spawn_ok; $exp->raw_pty(0); $exp->exp_internal(0); $exp->slave->stty(qw(-a)); #$exp->slave->stty(qw(raw -echo)); #$exp->slave->clone_winsize_from(\*STDIN); do_exp ($timeout, 'login', "$user_ts_user\r",0); do_exp ($timeout, "password:", "$user_ts_pass\r",0); do_exp ($timeout, 'Connected to line', "AT &F X3 S38=0 \\N2\r",1) +; $exp->interact(); sub do_exp { my ($_timeout, $_lookfor, $_send,$_slow) = @_; if (my $out = $exp->expect($_timeout,'-re',$_lookfor +)) { print "out=".$out."\n"; if ($_slow == 0){ $exp->send("$_send"); } else { print "Send_SLOW\n"; my @SlowChars = split(//,$_send); print Dumper(@SlowChars); my $return = $exp->send_slow(1,@SlowChars); print Dumper($return); } } else { print Dumper($exp); die "Timeout waiting for $_lookfor.\n"; } }
I can connect to the modem bank manually and type the whole string in no issue. I'm bemused - any assistance gratefully appreciated Kicks out of the send slow on 0 in S38=0 Simonspawn id(4): Does `: *********\n\r\n\r0460127 Connected to line MODEM: +4O at 115200 8N1\n\r\n\r' match: pattern #1: -re `Connected to line'? YES!! Before match string: `: *********\n\r\n\r0460127 ' Match string: `Connected to line' After match string: ` MODEM:4O at 115200 8N1\n\r\n\r' Matchlist: () Printed character 'A' to spawn id(4). Printed character 'T' to spawn id(4). AReceived 'T' from spawn id(4) Printed character ' ' to spawn id(4). TReceived ' ' from spawn id(4) Printed character '&' to spawn id(4). Received '&' from spawn id(4) Printed character 'F' to spawn id(4). &Received 'F' from spawn id(4) Printed character ' ' to spawn id(4). FReceived ' ' from spawn id(4) Printed character 'X' to spawn id(4). Received 'X' from spawn id(4) Printed character '3' to spawn id(4). XReceived '3' from spawn id(4) Printed character ' ' to spawn id(4). 3Received ' ' from spawn id(4) Printed character 'S' to spawn id(4). Received 'S' from spawn id(4) Printed character '3' to spawn id(4). SReceived '3' from spawn id(4) Printed character '8' to spawn id(4). 3Received '8' from spawn id(4) Printed character '=' to spawn id(4). 8Received '=' from spawn id(4) Starting EXPECT pattern matching...
In reply to Perl Expect Send Slow Oddness by setuk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |