|
From: Blackstone, J. D. <jda...@ci...> - 2001-12-07 14:50:00
|
I'm driving a screen-oriented menu interface. It's fairly easy to
control, but I'd like to be able to do things like:
sub go_to_main_menu
{
$expect->send(whatever's needed to get there);
$expect->expect(10, -notransfer, "Main menu prompt> ");
}
# This procedure enters the "Data" menu. A prerequisite for running this
routine
# is that the session must be in the main menu.
sub datamenu
{
$expect->expect(2,
["Main menu prompt> " => sub { ... }],
timeout => \&handle_wrong_menu_exception);
}
The idea is I could make my code cleaner and more modular if I could end
some routines by expecting a string to make sure of my location in the menu
system, but still leave the string in the buffer. I can live without it,
but it's a very attractive thought.
BTW, just because you might find it interesting, I'm subclassing Expect.
Fun! :) (I'd never succesfully worked with a glob reference until I looked
into Expect.pm. I never could figure it out.)
jdb
> -----Original Message-----
> From: Roland Giersig [mailto:RGi...@a1...]
> Sent: Friday, December 07, 2001 3:56 AM
> To: Blackstone J. David
> Cc: exp...@li...
> Subject: Re: [Expectperl-discuss] -notransfer ?
>
>
> > Is there a way to do what the -notransfer option to the expect
> > command in TCL expect does?
>
> No. As I'm not familiar with that option, I cannot say if it is easy
> to implement or not. From a quick glance on the manpage I'd say its
> easy, but the semantics and the usefulness is not quite clear. One
> could always combine patterns to get the same effect.
>
> Roland
> --
> RGi...@cp...
>
|