Sanko Robinson wrote:

> "Silverfox" wrote...
> : hey All, am trying to use the Aim module and getting this error:
> : Code =
> : #!/usr/bin/perl -w
> :
> : use Net::AIM;
> : $aim = new Net::AIM;
> : $aim->newconn(Screenname =>'anything',
> :                         Password =>'duh',)
> :                         or die "Error: Cannot Connect to Aim!";
> :
> : $conn = $aim->getconn();
> : $conn->set_handler('im_in', \&on_im);
> :
> : print "Bot loaded successfully!!\n";
> : $aim->start;
> :
> :
> : Error =
> : [laptop@localhost perl]$ ./aim.pl
> : Bot loaded successfully!!
> : Can't use an undefined value as a symbol reference at
> : /usr/lib/perl5/site_perl/5.6.1/Net/AIM/Connection.pm line 781.
> :         (in cleanup) No method called "handler" for  object. at ./aim.pl
> : line 0
> 
> You told Net::AIM to execute &on_im when your bot (I'm guessing) receives
> an Instant Message even though sub on_im is undefined.
> 
> You may want to define an handler for on_config and on_error. These two
> aren't managed very well by the module.
OK...I rewrote the code..created the sub's..this is what am getting..any 
ideas:

ERROR:
[laptop@localhost perl]$ ./aim.pl
Including on_config.pl.. OK!
Including on_error.pl.. OK!
Including on_evil.pl.. OK!
Including on_im.pl.. OK!
Including sendim.pl.. OK!
Including commands.pl.. OK!
Including dosleep.pl.. OK!
Including log_im.pl.. OK!
Including warners.pl.. OK!
Bot loaded successfully!!

Use of uninitialized value in split at 
/usr/lib/perl5/site_perl/5.6.1/Net/AIM.pm line 702.
Can't use an undefined value as a symbol reference at 
/usr/lib/perl5/site_perl/5.6.1/Net/AIM/Connection.pm line 781.
        (in cleanup) No method called "handler" for  object. at ./aim.pl 
line 0

Code:
#!/usr/bin/perl -w

$admin ="kesthekill";

use File::Basename;
chdir(dirname($0));

#to seed random numbers
srand time;

#write admin name to file.
open (DATA, ">admin.txt");
print DATA "$admin";
close(DATA);

#checking for needed directories.
if (-e "handlers" ne 1
        || -e "commands" ne 1
        || -e "extras" ne 1
        || -e "logs" ne 1) {
                print "Files are missing sucker: "
                . "handlers, commands, extras and logs. ";
                exit;
}

#Use Net::AIM to connect to AIM
use Net::AIM;

#Setup usage of above directory/files (handlers,commands extras and log).
@dirs = ("handlers","commands","extras","logs");
foreach $dir (@dirs) {
        opendir(DIR, "./$dir");
        foreach $file (sort(grep(!/^\./, readdir(DIR)))) {
                print "Including $file..";
                require "$dir/$file";
                print " OK!\n";
                }
                closedir(DIR);
                }

#start a new Net::AIM instance
$aim = new Net::AIM;

#Try to connect to the AIM server.
$aim->newconn(Screenname =>'kesundground',
                        Password =>'killer',)
                        or die "Error: Cannot Connect to Aim!";
#Net::AIM::Connection module reference
$conn = $aim->getconn();

#Set up the handlers for commands issued by the server.
$conn->set_handler('im_in', \&on_im);
$conn->set_handler('error', \&on_error);
$conn->set_handler('eviled', \&on_evil);
$conn->set_handler('config', \&on_config);


print "Bot loaded successfully!!\n\n";
$aim->start;


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to