Can't call method "add_handler" error? 
Author Message
 Can't call method "add_handler" error?

Hello all.  I am fairly inexperienced with Perl, done some minor Web
projects and whatnot with it, but never tried anything too advanced.
Lately, I've been exploring the AIM libraries in Net::AIM after
stumbling across this article:

A P2P AIM Robot in Perl

which discusses the Net::AIM library and how to build a simple AIM
bot.  In any case, I downloaded the module and installed it
successfully, and can logon with the test program and send/receive

 Anywho, the article has a test script that contains the following
code snippet:

my $aim = new Net::AIM;

my $conn = $aim->newconn(Screenname   => 'aimhandle',  
                         Password     => 'password')
    or die "Can't connect to AIM server.\n";

$conn->add_handler('config',    \&on_config);
$conn->add_handler('im_in',    \&on_im);  
$conn->add_handler('error',    \&on_error);

# later on...
sub on_config {

    my ($str) = $event->args;
    $self->send_im($nick, 'testing...');


However, when I try to run it, I get the following error message:
Can't call method "add_handler" without a package or object reference
at ./ line 13

I've searched on the Web and on newsgroups for this error and got very
few results, none of which seemed like applicable answers to my
problems.  I also searched the Web for code for other AIM bots, but
had no luck there.  (If you know of any sites that have such code, I'd
be greatful if you could pass on the link...)

In any case, any hints on what this error message means or how to fix
it?  TIA!

  Scott Mitchell
  mitchell AT 4GuysFromRolla DOT com

Tue, 20 Apr 2004 13:55:13 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Can't call method "add_handler" error.

2. Can't call method "uri"?

3. Can't call method "sockport"

4. Apache/Perl "Method Not Allowed" error

5. Can't call method "whatever" in empty package "whatever"...

6. "Can't call method "disconnect" on an undefined value..."

7. Error when calling system("cd /");

8. Net::Telnet - "Ambiguous call" error

9. can't call "writeblock"

10. Win32::Registry error.. Can't call method "Open" on an undefined value

11. Consistently getting "(in cleanup) Can't call method "FETCH" ...

12. XML::XSLT - 'Can't call method "getNodeValue" on an undefined value'?


Powered by phpBB® Forum Software