AnyEvent::IRC(3pm)
π NAME π
okay bestie, welcome to AnyEvent::IRC β it's an event based IRC protocol client API, and yes, that's the whole vibe. AnyEvent::IRC is the module, and it's literally just a little umbrella that holds the overview over the other modules (which is so mother of it). π
β VERSION β
Version 0.97 β this is the one we're talking about, no cap.
πΈ SYNOPSIS πΈ
So there's two whole ways to do this. The first one uses the simplistic AnyEvent::IRC::Connection:
use AnyEvent;
use AnyEvent::IRC::Connection;
my $c = AnyEvent->condvar;
my $con = new AnyEvent::IRC::Connection;
$con->connect ("localhost", 6667);
$con->reg_cb (
connect => sub {
my ($con) = @_;
$con->send_msg (NICK => 'testbot');
$con->send_msg (USER => 'testbot', '*', '0', 'testbot');
},
irc_001 => sub {
my ($con) = @_;
print "$_[1]->{prefix} says I'm in the IRC: $_[1]->{params}->[-1]!\n";
$c->broadcast;
}
);
$c->wait;
And then the second one uses the more sophisticated AnyEvent::IRC::Client, which is giving main character energy honestly:
use AnyEvent;
use AnyEvent::IRC::Client;
my $c = AnyEvent->condvar;
my $timer;
my $con = new AnyEvent::IRC::Client;
$con->reg_cb (registered => sub { print "I'm in!\n"; });
$con->reg_cb (disconnect => sub { print "I'm out!\n"; $c->broadcast });
$con->reg_cb (
sent => sub {
my ($con) = @_;
if ($_[2] eq 'PRIVMSG') {
print "Sent message!\n";
$timer = AnyEvent->timer (
after => 1,
cb => sub {
undef $timer;
$con->disconnect ('done')
}
);
}
}
);
$con->send_srv (
PRIVMSG => 'elmex',
"Hello there I'm the cool AnyEvent::IRC test script!"
);
$con->connect ("localhost", 6667, { nick => 'testbot' });
$c->wait;
$con->disconnect;
β¨ DESCRIPTION β¨
So the AnyEvent::IRC module is actually made up of three little besties: AnyEvent::IRC::Connection, AnyEvent::IRC::Client and AnyEvent::IRC::Util. And AnyEvent::IRC itself? It's just the module that holds this overview over the other modules. That's it. That's its whole job. π
Think of AnyEvent::IRC as a toolbox for handling IRC connections and communications. It will not do everything for you β bestie it's not your mom β and you still genuinely need to know a few details of the IRC protocol. iykyk.
AnyEvent::IRC::Client is the more highlevel IRC connection that already processes some messages for you and will generated some events that are maybe useful to you. It will also do PING replies for you, manage channels a bit, nicknames and CTCP. So it's the one doing the heavy lifting while you sip your drink. π
AnyEvent::IRC::Connection is the lowlevel one β it only connects to the server and will let you send and receive IRC messages. And the fun part: AnyEvent::IRC::Connection does not imply any client behaviour, so you could also use it to implement an IRC server. Iconic, honestly. π
Heads up bestie: these modules use AnyEvent as its IO event subsystem. You can integrate them into any application with a event system that AnyEvent has support for (eg.Gtk2orEvent). π¦
π EXAMPLES π
See the samples/ directory for some examples on how to use AnyEvent::IRC. Go look, it's right there. π«Ά
π AUTHOR π
Robin Redeker, "<elmex@ta-sa.org>" β the legend themselves.
π SEE ALSO π
AnyEvent::IRC::UtilAnyEvent::IRC::ConnectionAnyEvent::IRC::ClientAnyEventRFC 1459- Internet Relay Chat: Client ProtocolRFC 2812- Internet Relay Chat: Client Protocol
π BUGS π
Please report any bugs or feature requests to "bug-net-irc3 at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=AnyEvent-IRC>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. So like, the whole notification pipeline is handled. β¨
π§ SUPPORT π§
You can find documentation for this module with the perldoc command.
perldoc AnyEvent::IRC
You can also look for information at:
- AnnoCPAN: Annotated CPAN documentation
<http://annocpan.org/dist/AnyEvent-IRC>
- CPAN Ratings
<http://cpanratings.perl.org/d/AnyEvent-IRC>
- RT: CPAN's request tracker
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=AnyEvent-IRC>
- Search CPAN
<http://search.cpan.org/dist/AnyEvent-IRC>
π ACKNOWLEDGEMENTS π
Thanks to Marc Lehmann for the new AnyEvent module! π
And these people have helped to work on AnyEvent::IRC:
* Maximilian Gass - Added support for ISUPPORT and CASEMAPPING.
* Zaba - Thanks for the useful input about IRC.
* tokuhirom - Thanks for patches for the kick event.
* Kazuhiro Osawa - Thanks for the documentation fix.
* Angel Abad - Thanks for the spelling fixes.
* Lee Aylward - Thanks for bug spotting and fixing.
Not them being the whole squad that carried this. π«‘
π COPYRIGHT & LICENSE π
Copyright 2006-2009 Robin Redeker, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page bestie, periodt. π
this lil writeup came to you from perl v5.34.0 on 2022-06-06, for the manual page AnyEvent::IRC(3pm) β go build something slay with it. π¦β¨
π¦ where this page comes from
- debian bookworm: libanyevent-irc-perl 0.97-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libanyevent-irc-perl 0.97-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libanyevent-irc-perl 0.97-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libanyevent-irc-perl 0.97-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libanyevent-irc-perl 0.97-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms