Switches, Hubs, and Modems
cancel
Showing results for 
Search instead for 
Did you mean: 

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
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

.