vasanth.easyrider has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perl Monks

I have a requirement where i connect to remote system using Net::Telnet and execute a command and capture the output.

When i manually login to device and execute the command, the output is as follows

xe-1/2/3.5784 up up aenet --> ae4.5784
ae4.5784 up down inet 182.75.123.121/30

but when i run the command using Net::Telnet only the following output is getting captured -

xe-1/2/3.5784 up up aenet --

so the ">" character in the output is causing the issue i think.
can you help me on how to solve this

Replies are listed 'Best First'.
Re: Telnet output not captured
by Corion (Patriarch) on Mar 13, 2018 at 11:49 UTC

    Most likely, the regular expression you are using to detect the prompt of your device is too eager and recognizes --> as prompt.

    But without seeing the relevant input and maybe the debugging log of Net::Telnet, that's hard to tell. You can help us help you better by showing the relevant code and relevant data you receive from your device.

Re: Telnet output not captured
by thanos1983 (Parson) on Mar 13, 2018 at 12:23 UTC

    Hello vasanth.easyrider,

    Why are you using Net::Telnet and not Net::OpenSSH? Read this article for a short comparison and better understanding Telnet & SSH of the benefits.

    Provide us with a sample of code to help you.

    Looking forward to your reply, BR.

    Seeking for Perl wisdom...on the process of learning...not there...yet!