merlyn is too quick to jump to a conclusion here. <G>
It seems that
Expect combines the STDERR and STDOUT of the program together. By adding the parameter '2>errfile.tmp',
kudra and I determined that the STDERR from the program will go to the 'errfile.tmp' file, and STDOUT will go where expected.
The output in 'errfile.tmp' can now be processed as desired. This works quite well for her application, although it would be cooler if the output could be tied straight into a scalar, rather than having to open the file for processing.
Note that 'errfile.tmp' is not an ideal name, as it's not process specific, nor garanteed. We're aware that there are some suggestions for creating unique filenames, but that wasn't the point of this node.
Perl Cookbook, section 16.7, talks about redirecting I/O.
Revised code:
my $object = Expect->spawn("program 2>errfile.tmp"); # 1
my $error = ($object->expect(30, 'password:'))[1]; # 2
die "$error\n" if ($error); # 3
print $object "incorrectpassword\r"; # 4
$object->soft_close(); # 5
--Chris
e-mail jcwren