Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Need help on perl Expect Module

by atcroft (Abbot)
on Apr 23, 2014 at 05:11 UTC ( [id://1083276]=note: print w/replies, xml ) Need Help??


in reply to Need help on perl Expect Module

The Synopsis section of the Expect docs seems fairly straight-forward. While I haven't tested the code below, I believe it should work as intended.

my $exp = new Expect; $exp->raw_pty(1); $exp->spawn( $command, @params ) or die $!; $exp->expect( $timeout, [ qr/replace\s+\S+?\s+\[y\]es,\s+\[n\]o,\s+\[A\]ll,\s+\[N\]one,\s+ +\[r\]ename:/i => sub{ my $exp = shift; $exp->send( "A\n" ); exp_continue; } ], ); $exp->soft_close();

Hope that helps.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1083276]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-24 01:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found