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

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

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.