Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: problem in perl telnet module

by BrentDax (Hermit)
on Jan 25, 2005 at 12:05 UTC ( #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.)

=cut
--Brent Dax
There is no sig.

Replies are listed 'Best First'.
Re^2: problem in perl telnet module
by Fletch (Chancellor) 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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2022-01-27 03:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (70 votes). Check out past polls.

    Notices?