Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Perl, Telnet, and No Output

by aitap (Curate)
on Aug 13, 2014 at 18:57 UTC ( #1097330=note: print w/replies, xml ) Need Help??

in reply to Perl, Telnet, and No Output

I don't see where you set the prompt attribute of Net::Telnet object. As the documentation says,
The methods login() and cmd() use the prompt setting in the object to determine when a login or remote command is complete. Those methods will fail with a time-out if you don't set the prompt correctly.
Net::Telnet just doesn't know where the command output starts and where it ends, so it can't return you anything. You can use $telnet->errmsg to get its error message:
When mode is "return" then the method generating the error places an error message in the object and returns an undefined value in a scalar context and an empty list in list context. The error message may be obtained using errmsg().
$telnet->errmsg probably gets cleared after you call ->disconnect, so you see no error message.

Replies are listed 'Best First'.
Re^2: Perl, Telnet, and No Output
by DavisTasar (Initiate) on Aug 13, 2014 at 19:25 UTC
    This was it! Thank you! Yeah, once I set the prompt in the telnet connection settings, it's able to handle it accordingly. Now I just have to get the values of the array to pass to my logging sub so it doesn't separate out each line.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1097330]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2018-08-19 02:19 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (186 votes). Check out past polls.