SPUG: Net::Telnet

Jason Lamport jason at strangelight.com
Fri Sep 7 13:25:07 CDT 2001


At 5:28 PM -0700 9/6/01, Benjamin John Turner wrote:
>
>
>>This doesn't work. It says: "Can't call method 'print' without a 
>>package or object reference." And the line number is the first 
>>$t->print line in the change_pass subroutine.
>>
>>Is this possible? Does this make sense?
>
>	It should work as you described it, which probably means 
>there's a bug in your code. I'd walk through this code in the perl 
>debugger and make sure that you are getting a object back from your 
>call to Net::Telnet and that that object is being correctly passed 
>along to the other functions you've defined.

Or, if you're like me and hate using the Perl debugger, you could 
insert a debugging line like this at strategic places in your code 
(such as just before/after each subroutine call using $t, just before 
the return $t statement, etc.):

print( "\$t == $t (". ref( $t ) . ") at line __WHATEVER__\n");

It sounds like somewhere or other you're losing your reference to the 
object, at which point $t no longer contains what you think it does.

-jason

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/





More information about the spug-list mailing list