Switches, Hubs, and Modems
1753865 Members
7396 Online
108809 Solutions
New Discussion юеВ

Net::Telnet

 
Anders_35
Regular Advisor

Net::Telnet

Anyone use Perl and Net::Telnet for scripting commands to ProCurves?
My Perl is a little rusty, and I've managed to get myself stuck at the very beginning...

What prompt to specify? I thought

Prompt => "/Username\:/"

would be enough, clearly it isn't ...

4 REPLIES 4
Arunvijai_4
Honored Contributor

Re: Net::Telnet

use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
Prompt => '/bash\$ $/');
$t->open("sparky");
$t->login($username, $passwd);
@lines = $t->cmd("who");
print @lines;

Prompt should be shell prompt of a user.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Anders_35
Regular Advisor

Re: Net::Telnet

Sorry, my fault, original post was misleading.
It's the "login prompt" I can't seem to get right:

... waitfor(Match => '/Username: /')

Anders_35
Regular Advisor

Re: Net::Telnet


Waiting for /.*:/ instead did the trick.

:)
Anders_35
Regular Advisor

Re: Net::Telnet

.