in reply to help needed

In junipercmd you have:

Prompt => '/ERX02>$/' But in your example the prompt returned is ERX02#
So it won't match, thus won't return command to your program. Try a simple ERXO2. You really only need to set this once. ***You probably don't even need to set it at all as there is an inbuilt default that should work***.

As an aside you are obviously not using strict and passing things around as globals - this is bad. The logic for having subs that simply serve as more or less useless wrappers around the existing functions in Net::Telnet::Cisco eludes me. In your prompt RE you have @[ which will not be doing what you think it does, whatever that might be.

Does this work:

#!/usr/bin/perl use Net::Telnet::Cisco; use strict; my $rtrip = 'xx.xx.xx.xxx'; my $user = 'login'; my $pass = 'support123'; my $cmd = 'some command'; my $session = Net::Telnet::Cisco->new( Host => $rtrip, Prompt => '/ERX02/, Timeout => '30'); $session->login( Name => $login, Password => $pass, ); my @output = $session->cmd($cmd); print @output;

Replies are listed 'Best First'.
690918
by Mejaz (Novice) on Jun 08, 2008 at 12:57 UTC