CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Problems with Net::Telnet


New User

Dec 18, 2012, 9:36 AM

Post #1 of 4 (1973 views)
Problems with Net::Telnet Can't Post


First of all, I'm a beginner at perl - so be easy on me :)

I'm trying to write a program which uses Net::Telnet to check information on my router (switch), and I have a problem with some commands returning a lot of data.

I'm using:

my @tmp = $telnet->cmd("sh ver");

It causes a time-out and quits the program.

My theory is that the output data is page'd (the switch responds with either "--More--" or "Press c for continous, q for quit, <space> for one more row" and then halts until a char has been pressed. But "->cmd" doesn't issue this, tries to read for X seconds then quits.

Is there any way I can tell the Telnet-package to read everything, or do I need to use $telnet->send and $telnet->getline? :<

I know that this might be the wrong forum to ask this, but I'm running out of ideas. =)

Thanks in advance.

Best regards,


Dec 20, 2012, 1:44 AM

Post #2 of 4 (1945 views)
Re: [anton_] Problems with Net::Telnet [In reply to] Can't Post

Of course, paging *might* be the problem, but in general, the problem is likely that whatever the command sends back, does not match the prompt pattern Net::Telnet expects at this time.

I suggest to use dump_log() to see what was sent back.

New User

Jan 2, 2013, 9:49 AM

Post #3 of 4 (1847 views)
Re: [anton_] Problems with Net::Telnet [In reply to] Can't Post

This command generates a lot of output from a cisco device so paging might be the problem. Execute command "term length 0" to turn off paging.

Can you share the script and the output that is returned?

New User

Jan 2, 2013, 1:25 PM

Post #4 of 4 (1834 views)
Re: [Perlhack] Problems with Net::Telnet [In reply to] Can't Post


Sorry for the late answer.
The hardware is running other than cisco, so "term length 0" doesn't work.

However, I've rewritten everything and used basic socket I/O, so it works now. :)



Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives