Hi All,
I'm very new to POE and Perl, so please excuse me for what may seem like
an apparently stupid question. I have a working Bot in progress which
uses a MySql database as a backend for a number of functions. One of the
things I am trying to achieve is after querying the database for a list
of nicks which are to receive a specific message, and pushing each into
an Array variable, I want to use that Array to send a PRIVMSG to each of
the nicks within the array. According to the Man page this is possible
by referencing the array which to my knowledge I am doing, however the
message only gets sent to the first person in the array. The following
snippet of code is an example:
# Query the database and push each nick for online recipients into an
array.
my $notices = $dbh->prepare("SELECT operators.nick FROM
operators,online WHERE operators.notices='Y' AND operators.nick =
online.nick");
$notices->execute();
while (my $noteref = $notices->fetchrow_hashref()) {
push(@recpts, $noteref->{'nick'});
}
# I've tested the array at this point and it does get each of the
expected nick's added.
# Send a PRIVMSG to the recipients in the Array.
$kernel->post( 'OraBot', 'privmsg', "@recpts", "Blah Blah Blah" );
# Using the above, the PRIVMSG only goes the the first nick in the
array, I get no errors.
# If I try..
$kernel->post( 'OraBot', 'privmsg', @recpts, "Blah Blah Blah" );
# instead, once again, no errors, the message gets sent only to the
first nick in the array
# but in this case the message gets prepended with the other nick's
from the Array.
# eg. Nick1 receives a message: Nick2 Nick3 Blah Blah Blah
Now I know I can for each loop through the array sending the messages
individually, and I have done this, but thought this was a neater and
possibly a more economical solution and so would like to do it this way
if it's possible. So what am I doing wrong??
Thanks in advance for any assistance!!!
Regards
James Smith
--
Systems Administrator
Australian Institute of Marine Science
Townsville, QLD, Australia, 4810
Ph: +61 7 47534400 Fax: +61 7 47725852