|
From: Ankush <an...@en...> - 2001-05-18 18:02:18
|
Hi,
I am trying for an automatic user interaction with a user from a file on =
the same machine(and not from any remote login).
#!eusr/bin/perl
use Expect;
Expect->exp_init(\*STDIN);
$Expect::Log_Stdout=3D1;
$Expect::Debug=3D3;
$Expect::Exp_Internal=3D1;
$object=3DExpect->spawn("Makefile.PL");
$object->expect(10,"Enter the apppropriate number [3]:") ;
$object->send(10,'1\r');
$object->exp_match();
$object->exp_after();
$object->exp_match_number();
$object->send_slow(10,'1\r');
$object->hard_close();
>>>And here is a string of the output
Waiting for new data (10 seconds)...
spawn id(3): new data.
spawn id(3): EOF
spawn id(3): exit(2304)
spawn id(3): closing...
Closing spawn id(3).
Expect::hard_close('Expect=3DGLOB(0x82ca850)') called at =
/usr/lib/perl5/site_perl/5.005/Expect.pm line 743
Expect::_multi_expect(10, undef, 'ARRAY(0x82cbe94)') called at =
/usr/lib/perl5/site_perl/5.005/Expect.pm line 462
Expect::expect('Expect=3DGLOB(0x82ca850)', 10, 'Enter the =
apppropriate number [3]:') called at perlexp line 8
spawn id(3) closed.
Returning from expect with TIMEOUT or EOF
Printed character '1' to spawn id(3).
Printed character '\\' to spawn id(3).
Printed character 'r' to spawn id(3).
Closing spawn id(3).
Expect::hard_close('Expect=3DGLOB(0x82ca850)') called at perlexp =
line 27
Closing spawn id(3).
Expect::soft_close('Expect=3DGLOB(0x82ca850)') called at =
/usr/lib/perl5/site_perl/5.005/Expect.pm line 1458
Expect::DESTROY('Expect=3DGLOB(0x82ca850)') called at perlexp =
line 0
eval {...} called at perlexp line 0
So I dont find my pattern matching.Please let me know where am I wrong. =
Please send a sample perlexpect script for "file input output" if you =
have any.
Thanks,
Ankush
|