The stupid question is the question not asked | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Monks tend to be a lot like computers. The more precisely you follow the directions, the better the results you tend to get. The stuff below the posting box that says to use <code> tags isn't really just a suggestion--surely you looked at the preview and saw it was unreadable? In any event, since you didn't use Net::Telnet (perhaps you should explain why you're not using it), you can't then use the methods contained in Net::Telnet. What makes you think $telnet = `telnet $hostname`; is anything like use Net::Telnet;$telnet = new Net::Telnet (...);? Backticks execute the string in a subshell and return the output. They don't give you a handle to the process. Note that you have a problem here because you're doing a blocking read on a telnet, which is in turn sitting there waiting for some input. The analogous set of steps to reproduce Net::Telnet's actions would be something like: Open a socket. Fork. Arrange the socket to allow 2-way communication between the two processes. Have the child process exec telnet. Have the parent print commands through the socket to the child and read the output back. Properly close the telnet connection and terminate the child. Now doesn't it sound easier to use Net::Telnet? In reply to Re: Telnet Issue
by ssandv
|
|