Gossamer Forum
Home : General : Perl Programming :

Can't locate object method "connect" via package "Net::AIM" at handlers/on_disconnect.pl line 31.

Quote Reply
Can't locate object method "connect" via package "Net::AIM" at handlers/on_disconnect.pl line 31.
I'm fairly new to perl and I'm working on an AIM bot using Net::AIM. I'm trying to get it so that when the bot gets disconnected it will reconnect itself. The sub gets called, but I get that error. I don't know what's wrong. Can anyone help?

I get the following error:

Can't locate object method "connect" via package "Net::AIM" at handlers/on_disco
nnect.pl line 31.

Here is my code for that sub:

sub on_disconnect
{
my ($self, $event) = @_;

$directory = "logs/$screenname";
if (-e $directory && -d $directory)
{ #Well, it exists and it is a directory

}
else
{
mkdir "logs/$screenname";
}

#write the log.
open (DATA, ">>logs/$screenname/main.txt");
print DATA "$timestamp ****Disconnect****\n";
close(DATA);

print "Disconnect\n";

$self->connect();
}