Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: problem in perl telnet module

by BrentDax (Hermit)
on Jan 25, 2005 at 12:05 UTC ( [id://424836]=note: print w/replies, xml ) Need Help??

in reply to problem in perl telnet module

It would really help if we knew exactly when it's hanging--is it during open? login? cmd?

Have you tried using input_log, as the documentation recommends? If it's hanging during cmd, that could indicate that the Prompt regex is incorrect; input_log may help you debug that.

In the mean time, I'd like to point out a couple other problems:

  • You aren't bringing the module in the way it's intended to be. Remove the BEGIN block and the require, and replace it with a simple use Net::Telnet;.
  • You don't need new twice in new Net::­Telne­t->ne­w--either new Net::Telnet or Net::Telnet->new is fine. Use whichever you think looks better. (Frankly, I'm not sure why the two-new version even works.)

--Brent Dax
There is no sig.

Replies are listed 'Best First'.
Re^2: problem in perl telnet module
by Fletch (Bishop) on Jan 25, 2005 at 12:20 UTC
    $ perl -MO=Deparse,-p,-q -e '$telnet = new Net::Telnet->new( Timeout=> +20,Prompt => "/[\$%#>] $/");' ($telnet = 'Net::Telnet'->new->new('Timeout', 20, 'Prompt', ('/[$%#>] +' . $/)));

    Net::Telnet's new has the called-with-ref-use-its-class incantation (way back in IO::Handle::new). But you're right, it's unnecessary.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://424836]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-05-22 02:56 GMT
Find Nodes?
    Voting Booth?

    No recent polls found