SPUG: Default action from Except.pm

Mayank Agarwal mayank_a at students.iiit.ac.in
Wed Oct 29 20:27:50 PDT 2008


Dear all,
I am using Except.pm to automate a interactive script. I searched net, but
could not find, how to give a default action, if no expression matches in
except construct.

My code looks like the below:

my $exp = new Expect;
$exp->spawn("some_command")
$exp->expect(undef,
                  [qr/.*name.*/   =>
                    sub {
                      my $fh = shift;
                      $fh->send("myname\n");
                      exp_continue;
                    }
                   ],


                  [qr/.*city.*/   =>
                    sub {
                      my $fh = shift;
                      $fh->send("mycity\n");
                      exp_continue;
                    }
                   ],
);


Thanks and Regards
Mayank

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the spug-list mailing list