| 1 |
NAME |
| 2 |
AnyEvent::IRC - An event based IRC protocol client API |
| 3 |
|
| 4 |
VERSION |
| 5 |
Version 0.97 |
| 6 |
|
| 7 |
SYNOPSIS |
| 8 |
Using the simplistic AnyEvent::IRC::Connection: |
| 9 |
|
| 10 |
use AnyEvent; |
| 11 |
use AnyEvent::IRC::Connection; |
| 12 |
|
| 13 |
my $c = AnyEvent->condvar; |
| 14 |
|
| 15 |
my $con = new AnyEvent::IRC::Connection; |
| 16 |
|
| 17 |
$con->connect ("localhost", 6667); |
| 18 |
|
| 19 |
$con->reg_cb ( |
| 20 |
connect => sub { |
| 21 |
my ($con) = @_; |
| 22 |
$con->send_msg (NICK => 'testbot'); |
| 23 |
$con->send_msg (USER => 'testbot', '*', '0', 'testbot'); |
| 24 |
}, |
| 25 |
irc_001 => sub { |
| 26 |
my ($con) = @_; |
| 27 |
print "$_[1]->{prefix} says I'm in the IRC: $_[1]->{params}->[-1]!\n"; |
| 28 |
$c->broadcast; |
| 29 |
} |
| 30 |
); |
| 31 |
|
| 32 |
$c->wait; |
| 33 |
|
| 34 |
Using the more sophisticated AnyEvent::IRC::Client: |
| 35 |
|
| 36 |
use AnyEvent; |
| 37 |
use AnyEvent::IRC::Client; |
| 38 |
|
| 39 |
my $c = AnyEvent->condvar; |
| 40 |
|
| 41 |
my $timer; |
| 42 |
my $con = new AnyEvent::IRC::Client; |
| 43 |
|
| 44 |
$con->reg_cb (registered => sub { print "I'm in!\n"; }); |
| 45 |
$con->reg_cb (disconnect => sub { print "I'm out!\n"; $c->broadcast }); |
| 46 |
$con->reg_cb ( |
| 47 |
sent => sub { |
| 48 |
my ($con) = @_; |
| 49 |
|
| 50 |
if ($_[2] eq 'PRIVMSG') { |
| 51 |
print "Sent message!\n"; |
| 52 |
|
| 53 |
$timer = AnyEvent->timer ( |
| 54 |
after => 1, |
| 55 |
cb => sub { |
| 56 |
undef $timer; |
| 57 |
$con->disconnect ('done') |
| 58 |
} |
| 59 |
); |
| 60 |
} |
| 61 |
} |
| 62 |
); |
| 63 |
|
| 64 |
$con->send_srv ( |
| 65 |
PRIVMSG => 'elmex', |
| 66 |
"Hello there I'm the cool AnyEvent::IRC test script!" |
| 67 |
); |
| 68 |
|
| 69 |
$con->connect ("localhost", 6667, { nick => 'testbot' }); |
| 70 |
$c->wait; |
| 71 |
$con->disconnect; |
| 72 |
|
| 73 |
DESCRIPTION |
| 74 |
The AnyEvent::IRC module consists of AnyEvent::IRC::Connection, |
| 75 |
AnyEvent::IRC::Client and AnyEvent::IRC::Util. AnyEvent::IRC is just a |
| 76 |
module that holds this overview over the other modules. |
| 77 |
|
| 78 |
AnyEvent::IRC can be viewed as toolbox for handling IRC connections and |
| 79 |
communications. It won't do everything for you, and you still need to |
| 80 |
know a few details of the IRC protocol. |
| 81 |
|
| 82 |
AnyEvent::IRC::Client is a more highlevel IRC connection that already |
| 83 |
processes some messages for you and will generated some events that are |
| 84 |
maybe useful to you. It will also do PING replies for you, manage |
| 85 |
channels a bit, nicknames and CTCP. |
| 86 |
|
| 87 |
AnyEvent::IRC::Connection is a lowlevel connection that only connects to |
| 88 |
the server and will let you send and receive IRC messages. |
| 89 |
AnyEvent::IRC::Connection does not imply any client behaviour, you could |
| 90 |
also use it to implement an IRC server. |
| 91 |
|
| 92 |
Note that these modules use AnyEvent as it's IO event subsystem. You can |
| 93 |
integrate them into any application with a event system that AnyEvent |
| 94 |
has support for (eg. Gtk2 or Event). |
| 95 |
|
| 96 |
EXAMPLES |
| 97 |
See the samples/ directory for some examples on how to use |
| 98 |
AnyEvent::IRC. |
| 99 |
|
| 100 |
AUTHOR |
| 101 |
Robin Redeker, "<[email protected]>" |
| 102 |
|
| 103 |
SEE ALSO |
| 104 |
AnyEvent::IRC::Util |
| 105 |
|
| 106 |
AnyEvent::IRC::Connection |
| 107 |
|
| 108 |
AnyEvent::IRC::Client |
| 109 |
|
| 110 |
AnyEvent |
| 111 |
|
| 112 |
RFC 1459 - Internet Relay Chat: Client Protocol |
| 113 |
|
| 114 |
RFC 2812 - Internet Relay Chat: Client Protocol |
| 115 |
|
| 116 |
BUGS |
| 117 |
Please report any bugs or feature requests to "bug-net-irc3 at |
| 118 |
rt.cpan.org", or through the web interface at |
| 119 |
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=AnyEvent-IRC>. I will be |
| 120 |
notified, and then you'll automatically be notified of progress on your |
| 121 |
bug as I make changes. |
| 122 |
|
| 123 |
SUPPORT |
| 124 |
You can find documentation for this module with the perldoc command. |
| 125 |
|
| 126 |
perldoc AnyEvent::IRC |
| 127 |
|
| 128 |
You can also look for information at: |
| 129 |
|
| 130 |
* AnnoCPAN: Annotated CPAN documentation |
| 131 |
|
| 132 |
<http://annocpan.org/dist/AnyEvent-IRC> |
| 133 |
|
| 134 |
* CPAN Ratings |
| 135 |
|
| 136 |
<http://cpanratings.perl.org/d/AnyEvent-IRC> |
| 137 |
|
| 138 |
* RT: CPAN's request tracker |
| 139 |
|
| 140 |
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=AnyEvent-IRC> |
| 141 |
|
| 142 |
* Search CPAN |
| 143 |
|
| 144 |
<http://search.cpan.org/dist/AnyEvent-IRC> |
| 145 |
|
| 146 |
ACKNOWLEDGEMENTS |
| 147 |
Thanks to Marc Lehmann for the new AnyEvent module! |
| 148 |
|
| 149 |
And these people have helped to work on AnyEvent::IRC: |
| 150 |
|
| 151 |
* Maximilian Gass - Added support for ISUPPORT and CASEMAPPING. |
| 152 |
* Zaba - Thanks for the useful input about IRC. |
| 153 |
* tokuhirom - Thanks for patches for the kick event. |
| 154 |
* Kazuhiro Osawa - Thanks for the documenation fix. |
| 155 |
* Angel Abad - Thanks for the spelling fixes. |
| 156 |
* Lee Aylward - Thanks for bug spotting and fixing. |
| 157 |
|
| 158 |
COPYRIGHT & LICENSE |
| 159 |
Copyright 2006-2009 Robin Redeker, all rights reserved. |
| 160 |
|
| 161 |
This program is free software; you can redistribute it and/or modify it |
| 162 |
under the same terms as Perl itself. |
| 163 |
|