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
in thread Telnet Issue by jag

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.