From: Sascha G. <Sas...@al...> - 2003-06-05 08:06:15
|
Hi all first I want to thank you for your support in the past. You were right. My Expect was too old. I had long discussions with our SysAdmin. Now I got Perl 5.6.1 with Expect 1.14 and it seems to work. But I have another problem. If I use: $exp = Expect->spawn("getIOR"); $exp->log_file("rmtest.log"); $exp->log_file->print("############################################################################################\n"); $exp->log_file->print(" TESTCASE: Get initial IOR from the RM of the selected test station\n"); $exp->log_file->print("############################################################################################\n\n"); $exp->expect(70, ['-re', "tftp> Received.*\n" => sub { exp_continue; }], ["(IOR:[0-9a-f]+)" => sub{ $Root = $exp->exp_match(); exp_continue; }], "STARTUP FINISHED" ); $exp->log_file->print("\n"); $exp->hard_close(); $mtnm->log_file("rmtest.log"); I get in my logfile: ############################################################################################ TESTCASE: Get initial IOR from the RM of the selected test station ############################################################################################ tftp> Received 366 bytes in 0.1 seconds tftp> Testing on slbwnf with MTNBE70-01G IOR:00323c930000002a49444c3a6f6f632e636f6d2f436f734e616d696e672f4f424e616d696e67436f6e746578743a312e3000db80000000010000000000000074000102540000000f3134392e3230342e3132342e373900005aac6a0000000025abacab305f526f6f74504f4100436f6e74657874504f410000cafebabe3e4bc625000000001581380000000100000001000000200012080000010001000000020001002005010001000101000000000100010109 STARTUP FINISHED If I use: $exp->expect(70, '-re', ".*FINISHED"); I get: ############################################################################################ TESTCASE: Get initial IOR from the RM of the selected test station ############################################################################################ STARTUP FINISHED My Problem is that I do not necessarily know what to expect. I want to expect all, save it to a $var and do the interpretation later. So what is wrong? Greets Sascha |
From: expect <ex...@ih...> - 2003-06-05 14:50:06
|
On Thu, 05 Jun 2003 10:06:00 +0200 Sascha Gagalon <Sas...@al...> wrote: > Hi all > > first I want to thank you for your support in the past. You were right. > My Expect was too old. I had long discussions with our SysAdmin. Now I > got Perl 5.6.1 with Expect 1.14 and it seems to work. > But I have another problem. > > > > If I use: > > $exp = Expect->spawn("getIOR"); > $exp->log_file("rmtest.log"); > > $exp->log_file->print("############################################################################################\n"); > $exp->log_file->print(" TESTCASE: Get initial IOR from the RM of the > selected test station\n"); > > $exp->log_file->print("############################################################################################\n\n"); > $exp->expect(70, > ['-re', "tftp> Received.*\n" => sub { exp_continue; }], > ["(IOR:[0-9a-f]+)" => sub{ $Root = $exp->exp_match(); exp_continue; }], > "STARTUP FINISHED" > ); > $exp->log_file->print("\n"); > $exp->hard_close(); > $mtnm->log_file("rmtest.log"); > > I get in my logfile: > > ############################################################################################ > TESTCASE: Get initial IOR from the RM of the selected test station > ############################################################################################ > > tftp> Received 366 bytes in 0.1 seconds > tftp> Testing on slbwnf with MTNBE70-01G > IOR:00323c930000002a49444c3a6f6f632e636f6d2f436f734e616d696e672f4f424e616d696e67436f6e746578743a312e3000db80000000010000000000000074000102540000000f3134392e3230342e3132342e373900005aac6a0000000025abacab305f526f6f74504f4100436f6e74657874504f410000cafebabe3e4bc625000000001581380000000100000001000000200012080000010001000000020001002005010001000101000000000100010109 > > STARTUP FINISHED > > > If I use: > > $exp->expect(70, '-re', ".*FINISHED"); > > I get: > > ############################################################################################ > TESTCASE: Get initial IOR from the RM of the selected test station > ############################################################################################ > > STARTUP FINISHED > > > My Problem is that I do not necessarily know what to expect. I want to > expect all, save it to a $var and do the interpretation later. > So what is wrong? > > Greets Sascha This seems like perl and not expect, I think this is just because .* is doing the usual greedy match. So if you do a multiline match it should work. hth |
From: Sascha G. <Sas...@al...> - 2003-06-06 09:55:52
|
expect wrote: > On Thu, 05 Jun 2003 10:06:00 +0200 > Sascha Gagalon <Sas...@al...> wrote: > > >>Hi all >> >>first I want to thank you for your support in the past. You were right. >>My Expect was too old. I had long discussions with our SysAdmin. Now I >>got Perl 5.6.1 with Expect 1.14 and it seems to work. >>But I have another problem. >> >> >> >>If I use: >> >> $exp = Expect->spawn("getIOR"); >> $exp->log_file("rmtest.log"); >> >>$exp->log_file->print("############################################################################################\n"); >> $exp->log_file->print(" TESTCASE: Get initial IOR from the RM of the >>selected test station\n"); >> >>$exp->log_file->print("############################################################################################\n\n"); >> $exp->expect(70, >> ['-re', "tftp> Received.*\n" => sub { exp_continue; }], >> ["(IOR:[0-9a-f]+)" => sub{ $Root = $exp->exp_match(); exp_continue; }], >> "STARTUP FINISHED" >> ); >> $exp->log_file->print("\n"); >> $exp->hard_close(); >> $mtnm->log_file("rmtest.log"); >> >>I get in my logfile: >> >>############################################################################################ >> TESTCASE: Get initial IOR from the RM of the selected test station >>############################################################################################ >> >>tftp> Received 366 bytes in 0.1 seconds >>tftp> Testing on slbwnf with MTNBE70-01G >>IOR:00323c930000002a49444c3a6f6f632e636f6d2f436f734e616d696e672f4f424e616d696e67436f6e746578743a312e3000db80000000010000000000000074000102540000000f3134392e3230342e3132342e373900005aac6a0000000025abacab305f526f6f74504f4100436f6e74657874504f410000cafebabe3e4bc625000000001581380000000100000001000000200012080000010001000000020001002005010001000101000000000100010109 >> >>STARTUP FINISHED >> >> >>If I use: >> >> $exp->expect(70, '-re', ".*FINISHED"); >> >>I get: >> >>############################################################################################ >> TESTCASE: Get initial IOR from the RM of the selected test station >>############################################################################################ >> >>STARTUP FINISHED >> >> >>My Problem is that I do not necessarily know what to expect. I want to >>expect all, save it to a $var and do the interpretation later. >>So what is wrong? >> >>Greets Sascha > > > > > This seems like perl and not expect, I think this is just because .* is doing the usual greedy > match. So if you do a multiline match it should work. > > hth > > > ------------------------------------------------------- > This SF.net email is sponsored by: Etnus, makers of TotalView, The best > thread debugger on the planet. Designed with thread debugging features > you've never dreamed of, try TotalView 6 free at www.etnus.com. > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > What's the difference and how do I perform it? Sorry, I am relatively new to Perl and Expect. Greets Sascha |