sub irc_public {
my ($sender, $who, $where, $what) = @_[SENDER, ARG0 .. ARG2];
my $nick = ( split /!/, $who )[0];
my $channel = $where->[0];
if ( my ($rot13) = $what =~ /^rot13 (.+)/ ) {
$rot13 =~ tr[a-zA-Z][n-za-mN-ZA-M];
$irc->yield( privmsg => $channel => "$nick: $rot13" );
}
return;
}
which suggests an approach; an approach, only, but the referenced part of the doc says:
Lists the logged-on users matching a particular channel name, hostname, nickname, or what-have-you. Takes one optional argument: a string for it to search for. Wildcards are allowed; in the absence of this argument, it will return everyone who's currently logged in (bad move). Tack an "o" on the end if you want to list only IRCops, as per the RFC.
All told, that makes me wonder if there's some internal magic to stuff an arrayref of who instances into $nick, which is then returned.
And, for good measure, if you haven't done so already, check "whois" and "whowas." BUT, reiterating my warning, this is a WAG from a non-user of IRC and POE. | [reply] [d/l] [select] |
In that case it was using the variable $who as a something different than what it means in this case. It really is just a bad choice of varible names in that example i beleive, since it conflicts with a method that is also defined. Thanks though.
| [reply] |
There's one obvious problem with your call(): it uses "who" as the session name so the call goes nowhere. The first argument must be the name of your IRC session. You can directly call handlers on the IRC session object but that doesn't seem the right way of using it. Synchronous calls should only be used when you can immediately obtain a result, which in this case you can't anyway because it has to handle IRC protocol stuff first which is itself asynchronous.
Try $irc->yield(who => $where); with the example code in the SYNOPSIS, as the last thing in _start. The result should be returned in some message---which one will be visible in the output from the _default handler.
| [reply] [d/l] |
| [reply] |