Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Mysterious net::telnet error

by dmckee (Scribe)
on Mar 11, 2001 at 20:20 UTC ( #63620=perlquestion: print w/ replies, xml ) Need Help??
dmckee has asked for the wisdom of the Perl Monks concerning the following question:

I've had a quick play with Net::telnet and have got the following program working -

#!/bin/usr/perl -w use strict; use Net::Telnet (); my $mud = new Net::Telnet; $mud->open(Host=>"furry.org",Port=>"8888",Timeout=>"10"); $mud->waitfor('/Welcome/'); #wait for a reply $mud->print('connect darrenlupus censoredpassword'); #login $mud->print('morph wolf'); #send a command $mud->print('QUIT'); #let the other side disconnect gracefully
which is about as simple as it can get. It's all working correctly, and even correctly quits at the end, but I get a
Argument "" isn't numeric in numeric gt (>) at D:/Perl/site/lib/Net/Telnet.pm line 2569. error. Am I doing something wrong?
Debugging info: ActiveState Perl (Win32), downloaded Net::Telnet using ppm...

Comment on Mysterious net::telnet error
Download Code
Re: Mysterious net::telnet error
by dmckee (Scribe) on Mar 11, 2001 at 20:30 UTC
    sub _optimal_blksize { my ($blksize) = @_; return $blksize ## LINE 2569 if defined $blksize and $blksize > 0 and $blksize <= 1_048_576; 8192; } # end sub _optimal_blksize
    Added at the request of arhuman
    Why the hell have eight (now nine) people ++'d this?? I can understand upvoting the root Q, but not this!

      Someone is calling _optimal_blksize("").

      The fastest way I know to find this is to add -d to the Perl command line so the debugger runs then type "c" at the debugger prompt. This will cause you to get a stack backtrace when a warning happens, which is usually enough to track down the source of the bug.

      I wish the debugger had an option to break on warnings. It would be easy to hack that option in by having dbwarn() check if the warnLevel option is greater than 1 and, if so, force $single= 1 when it is finished. I'll try to find time to send in a patch for that. (:

      I suspect (and hope) that there is a module that provides stack backtraces for warnings via a simple -Mmodule=option command-line switch to Perl, but I'm not aware of one.

              - tye (but my friends call me "Tye")
Re: Mysterious net::telnet error (no answer, but 2 ideas)
by ybiC (Prior) on Mar 12, 2001 at 02:35 UTC
    A few thoughts, dmckee, worth exactly what you paid for them:   {grin}
    • Google search on the error message turns up nothing.   Darn.
    • I try to use cmd(); instead of print().   You've probably already perused it, but this is from Net::Telnet pod's examples:
      use Net::Telnet (); $host = new Net::Telnet (Timeout => 30, Prompt => '/[%#>] $/'); $prompt = '_funkyPrompt_'; $host -> open($hostname); $host -> login($username, $passwd); $host -> prompt("/$prompt\$/"); $host -> cmd("set prompt = '$prompt'"); $host -> cmd("..."); $host -> close;
    • It doesn't appear very relevant, but here's what I could find in the pod about block size.
      max_buffer_length - maximum size of input buffer $len = $obj->max_buffer_length; $prev = $obj->max_buffer_length($len); This method designates the maximum size of the input buffer. An error is generated when a read causes the buffer to exceed this limit. The default value is 1,048,576 bytes (1MB). The input buffer can grow much larger than the block size when you continuously read using getline() or waitfor() and the data stream contains no newlines or matching waitfor patterns. With no argument this method returns the current maximum buffer length set in the object. With an argument it sets the maximum buffer length to $len and returns the previous value.
    • Maybe you've uncovered a glitch with that server, or a bug in Net::Telnet.   If nothing else, the module author, Jay Rogers, invites comments or suggestions.
        cheers,
        Don
        stumbling toward Perl Adept
        (it's pronounced "why-bick")

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://63620]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2014-08-29 03:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (275 votes), past polls