in reply to Telneting to a 2511 Access Server Device on line 2005

You want to add Port => 2005 after your Host option to specify a port. See the docs for Net::Telnet, specifically the documentation for the new method.

Replies are listed 'Best First'.
Re^2: Telneting to a 2511 Access Server Device on line 2005
by llod45 (Initiate) on Mar 30, 2005 at 19:11 UTC
    Ok so I have been able to get this to work* - somewhat.

    * - Not literal because its not how i envisioned it.

    Here is what I got, I created an input.log to well capture the input in a log so that I can see in better detail as to what is going on. It turns out the log file produces the output I was looking for the perl script to output.

    Here is what the current code looks like:
    #!/usr/bin/perl no strict; #### Define Library Locations #### #use lib '/root/Net-Telnet-3.03/blib/lib/Net/'; use lib '/root/Net-Telnet-Cisco-1.10/blib/lib/'; #### Define Modules to use #### #use Net::Telnet; use Net::Telnet::Cisco; #### Create New Telnet Connection #### my $telnet = Net::Telnet::Cisco->new(Host=>'1.2.3.4', Port=>2005, Inpu +t_log => "input.log", Timeout=>5, Errmode=>'die'); $telnet->waitfor('/Username:/') or die('FAILED'); $telnet->print('XXX'); $telnet->waitfor('/Password:/') or die('FAILED'); $telnet->print('XXX'); $telnet->cmd("show ver");

    Here is the output of input.log:

    User Access Verification

    Username: XXX
    Password:


    ^MDIAG> show ver
    ^M BLAH BLAH BLAH VERSION NUMBER BLAH
    ^MDIAG>

    Now my question is deeper, why is this not outputing via the print @output; statement, it seems like @output isnt even being pushed the output of "..cmd(show ver)"?

    My second question is why do i continue to get a command-timed out line ## - in reference to the cmd(show ver); line, even though the output.log shows it executed correctly? Is there a way to kill the cmd() before my 2 second timeout?

    Also does the ^M have anything to do with either question?

    Thanks for the help,