Skip Menu |

This queue is for tickets about the Net-Telnet CPAN distribution.

Report information
The Basics
Id: 16313
Status: rejected
Priority: 0/
Queue: Net-Telnet

People
Owner: Nobody in particular
Requestors: zhengyli [...] cisco.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: Can login password prompt be tailord
Distribution:3.03 Perl version:5.8.6 OS:Linux Could you please make a minor but extremely helpful (I think)change to Telnet module, make the password prompt be tailed by user on method invocation. So that when password prompt like "password for <userid>" could be handled by Telenet module smoothly without reinventing the wheel except this minor difference. /Net/Telnet.pm 1121 ## Wait for password prompt. 1122 $self->waitfor(Match => '/password[: ]*$/i', 1123 Errmode => "return") 1124 or do { 1125 return &$error("eof read waiting for password prompt") 1126 if $self->eof; 1127 return &$error("timed-out waiting for password prompt"); 1128 }; I think just change Line 1121 to $self->waitfor(Match => $pwd_prompt]*$/i', where $pwd_prompt is an optional parameter with default value '/password[: ]*$/i'. Thank you very much.
From: Jeff Puckett
[guest - Tue Dec 6 04:53:32 2005]: Show quoted text
> Distribution:3.03 > Perl version:5.8.6 > OS:Linux > > Could you please make a minor but extremely helpful (I think)change to > Telnet module, > make the password prompt be tailed by user on method invocation. > So that when password prompt like "password for <userid>" could be > handled by Telenet > module smoothly without reinventing the wheel except this minor > difference. > > /Net/Telnet.pm > > 1121 ## Wait for password prompt. > 1122 $self->waitfor(Match => '/password[: ]*$/i', > 1123 Errmode => "return") > 1124 or do { > 1125 return &$error("eof read waiting for password > prompt") > 1126 if $self->eof; > 1127 return &$error("timed-out waiting for password > prompt"); > 1128 }; > > I think just change Line 1121 to $self->waitfor(Match => > $pwd_prompt]*$/i', > > where $pwd_prompt is an optional parameter with default value > '/password[: ]*$/i'. > > Thank you very much.
This affects telnet to an Opteron server running RedHat. Output: raldtest6-066 (Linux release 2.4.21-32.ELsmp #1 SMP Fri Apr 15 21:03:28 EDT 2005) (2) login: test Password for test:
Sorry but login() is only meant to handle the general case. There are just too many different ways to login and it really is quite simple to use waitfor() and print() to respond to login prompts. As the documentation says: Use a combination of C<print()> and C<waitfor()> as an alternative to C<login()> or C<cmd()> when they don't do what you want.