--- Net-IRC3/lib/Net/IRC3.pm 2006/07/17 15:09:20 1.7 +++ Net-IRC3/lib/Net/IRC3.pm 2007/02/17 13:07:05 1.14 @@ -7,37 +7,80 @@ =head1 NAME -Net::IRC3 - An IRC Protocol module which is event system independend +Net::IRC3 - An event system independend IRC protocol module =head1 VERSION -Version 0.21 +Version 0.5 =cut -our $VERSION = '0.21'; +our $VERSION = '0.5'; =head1 SYNOPSIS +Using the simplistic L: + + use AnyEvent; use Net::IRC3::Connection; + my $c = AnyEvent->condvar; + my $con = new Net::IRC3::Connection; - $con->connect ("test.not.at.irc.net", 6667); + $con->connect ("localhost", 6667); + + $con->reg_cb (irc_001 => sub { print "$_[1]->{prefix} says i'm in the IRC: $_[1]->{trailing}!\n"; $c->broadcast; 0 }); + $con->send_msg (undef, NICK => undef, "testbot"); + $con->send_msg (undef, USER => 'testbot', "testbot", '*', '0'); + + $c->wait; + +Using the more sophisticatd L: + + use AnyEvent; + use Net::IRC3::Client::Connection; + + my $c = AnyEvent->condvar; + my $timer; + my $con = new Net::IRC3::Client::Connection; + + $con->reg_cb (registered => sub { print "I'm in!\n"; 0 }); + $con->reg_cb (disconnect => sub { print "I'm out!\n"; 0 }); + $con->reg_cb ( + sent => sub { + if ($_[2] eq 'PRIVMSG') { + print "Sent message!\n"; + $timer = AnyEvent->timer (after => 1, cb => sub { $c->broadcast }); + } + 1 + } + ); + + $con->send_srv (PRIVMSG => "Hello there i'm the cool Net::IRC3 test script!", 'elmex'); + + $con->connect ("localhost", 6667); + $con->register (qw/testbot testbot testbot/); + + $c->wait; + undef $timer; + + $con->disconnect; =head1 DESCRIPTION -L itself is a simple building block for an IRC client. +The L module consists of L, L +and L. L only contains this documentation. It manages connections and parses and constructs IRC messages. -L is I simple, if you don't want to care about +L is I simple, if you don't want to care about all the other things that a client still has to do (like replying to PINGs and remembering who is on a channel), I recommend to read -the L page instead. +the L page instead. -Note that this module uses AnyEvent as it's IO event subsystem. -You can integrate Net::IRC3 into any application with a event system +Note that the *::Connection module uses AnyEvent as it's IO event subsystem. +You can integrate them into any application with a event system that AnyEvent has support for (eg. L or L). =head1 EXAMPLES @@ -50,9 +93,11 @@ =head1 SEE ALSO +L + L -L +L L @@ -100,7 +145,7 @@ =head1 COPYRIGHT & LICENSE -Copyright 2006 Robin Redker, all rights reserved. +Copyright 2006 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.