Subject: | Could you add a customizable prompt feature? |
Hi Bruno,
Thanks for your effort in Net::SSH::Expect, I'm using it in automation
test on our hardware firewall, and we found it very useful. But we have
to change a little bit as following patch to make it work for our firewall:
--- Expect.pm.old 2008-04-11 20:47:26.000000000 +0800
+++ Expect.pm 2008-04-11 20:50:13.000000000 +0800
@@ -161,7 +161,7 @@
$self->_sec_expect($timeout,
[ qr/\(yes\/no\)\?\s*$/ => sub { $exp->send("yes$t");
exp_continue; } ],
[ qr/[Pp]assword.*?:|[Pp]assphrase.*?:/ => sub {
$exp->send("$password$t"); } ],
- [ qr/ogin:\s*$/ => sub { $exp->send("$user$t");
exp_continue; } ],
+ [ qr/ogin:\s*$|[Uu]ser:\s*$/ => sub {
$exp->send("$user$t"); exp_continue; } ],
[ qr/REMOTE HOST IDEN/ => sub { print "FIX: .ssh/known_hosts\n";
exp_continue; } ],
[ timeout => sub
{
You see, you have the common prompt included in _sec_expect, but there
are still many places we have some other prompts. I think it would be
better to allow the user specify the login prompt in new(), both user
name and password fields. They can have some default values if the user
doesn't specify one.