Hello all, I am attempting to connect to a network device using Net::Telnet, the issue is that the device needs to have a new line sent after connection to load the login window. Currently (and not working) my code is as follows:
#! /usr/bin/perl use strict; use warnings; use Net::Telnet; use Data::Dumper; my $t = new Net::Telnet (Timeout => 10, Prompt => '/>/'); $t->open("192.168.3.35"); $t->print(""); $t->login('user','****'); $t->print('3'); $t->print('1'); my @lines = $t->print('2'); print Dumper @lines; exit(0);
I have also tried with:
#! /usr/bin/perl use strict; use warnings; use Net::Telnet; use Data::Dumper; my $t = new Net::Telnet (Timeout => 10, Prompt => '/>/'); $t->open("192.168.3.35"); $t->login('user','****'); $t->print('3'); $t->print('1'); my @lines = $t->print('2'); print Dumper @lines; exit(0);
I have also attempted the $t->waitfor('/string/') option but all return the following error:
timed-out waiting for login prompt at rici_test.pl line 13
So, in essence, I am trying to send a carriage return before attempting to log in and I am having no luck. This is part of a log gathering utility, connecting to a Rad RICi-T3. My other option is to go through the web gui but then the interface is all in Javascript so, WWW::Mechanize does not work. Any help would be greatly appreciated. Thanks

In reply to Net::Telnet issue by dimishome

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.