Net::IRC "args" type?

E

echohtp

does anyone know what format the data thats returned from a privmsg
while using Net::IRC? im trying to split the text then search for a
string but it doesnt seem to work right. here is a code snippet, maybe
someone can see the problem, i cant.
here is my on_msg subroutine.

# what to do on msg
###################
sub on_msg {
my ($conn, $event) = @_;
my (@msg) = split /\s+/, $event->{args};
# $conn->privmsg($event->{nick},"..");
# check list of "super_users" for correct user and pass :)
print $event->{args};
if ($event->{args} eq 'su'){
if (defined($super_users{$event->{nick}}) &&
$super_users{$event->{nick}} eq $msg[1])
{
$conn->privmsg($event->{nick}, "Hello $event->{nick} you
have root access");
$have_root{$event->{nick}} = 1;
}
else
{
$conn->privmsg($event->{nick}, "Incorrect password...");
}
}
else
{
$conn->privmsg($event->{nick}, "Why are you msging me, i dont
have much set up for you currently);
}
}
$conn->add_handler('msg', \&on_msg);

it doesnt seem to get past the first if statement checking if the 1st
part of the privmsg was 'su' there was a output statment after it for
debugging but it never made it that far, always went straight to the
last privmsg "Why are you msging me...."

any help would be greatly appericated.

and here are what the hashes look like that im testing. which are
declared above the subroutine.

%super_users= ( "nenn" => "XXXXXXXXX");
%have_root = ("nenn" => 0);

if anyone knows a better way to do this i would be more than grateful
to listen :)
 
E

echohtp

ah im sorry i left out so much information! :( it doesnt pass the test
when i split it all that i get out of a event dump is

[
args = what ever i typed goes here
]

and i dont know how i can check whats in the msg[0] it wont print to my
terminal but the regular expression i didnt even think about, thanks!
ill try that now :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top