in reply to Expect Issues

HalNineThousand:

I was just looking at the Expect documentation, and the example looks different that your code. They didn't use new() to create the Expect object, instead they used spawn(). Also, they use spawn differently than you do. They have the command and arguments separated. So I think you should try changing the first few lines of your open_telnet subroutine to the following, and see if it helps.

sub open_telnet { my (@cmd, $res, $before, @parm); @cmd = ("telnet", "wogglebug"); $abi = Expect->spawn(@cmd) or die "Can't do expect'"; $res = $abi->expect(5, "/ #", "not known");

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^2: Expect Issues
by HalNineThousand (Beadle) on Dec 31, 2010 at 16:22 UTC

    roboticus, I should have included this. I tried that -- using the arguments separately, but it never seemed to work, at least not with the other program, so I left it that way with telnet when I tested. I found a number of examples and every example I found gave the command and arguments as just one string. But somehow it seems to work now -- doesn't seem to make a difference.

    Thanks for picking up on that. It's probably several errors like that, all together, that are creating the problem.