ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Net-IRC3/lib/Net/IRC3.pm
(Generate patch)

Comparing Net-IRC3/lib/Net/IRC3.pm (file contents):
Revision 1.7 by elmex, Mon Jul 17 15:09:20 2006 UTC vs.
Revision 1.14 by elmex, Sat Feb 17 13:07:05 2007 UTC

5 5
6our $ConnectionClass = 'Net::IRC3::Connection'; 6our $ConnectionClass = 'Net::IRC3::Connection';
7 7
8=head1 NAME 8=head1 NAME
9 9
10Net::IRC3 - An IRC Protocol module which is event system independend 10Net::IRC3 - An event system independend IRC protocol module
11 11
12=head1 VERSION 12=head1 VERSION
13 13
14Version 0.21 14Version 0.5
15 15
16=cut 16=cut
17 17
18our $VERSION = '0.21'; 18our $VERSION = '0.5';
19 19
20=head1 SYNOPSIS 20=head1 SYNOPSIS
21 21
22Using the simplistic L<Net::IRC3::Connection>:
23
24 use AnyEvent;
22 use Net::IRC3::Connection; 25 use Net::IRC3::Connection;
26
27 my $c = AnyEvent->condvar;
23 28
24 my $con = new Net::IRC3::Connection; 29 my $con = new Net::IRC3::Connection;
25 30
26 $con->connect ("test.not.at.irc.net", 6667); 31 $con->connect ("localhost", 6667);
27 32
33 $con->reg_cb (irc_001 => sub { print "$_[1]->{prefix} says i'm in the IRC: $_[1]->{trailing}!\n"; $c->broadcast; 0 });
34 $con->send_msg (undef, NICK => undef, "testbot");
35 $con->send_msg (undef, USER => 'testbot', "testbot", '*', '0');
36
37 $c->wait;
38
39Using the more sophisticatd L<Net::IRC3::Client::Connection>:
40
41 use AnyEvent;
42 use Net::IRC3::Client::Connection;
43
44 my $c = AnyEvent->condvar;
45
46 my $timer;
47 my $con = new Net::IRC3::Client::Connection;
48
49 $con->reg_cb (registered => sub { print "I'm in!\n"; 0 });
50 $con->reg_cb (disconnect => sub { print "I'm out!\n"; 0 });
51 $con->reg_cb (
52 sent => sub {
53 if ($_[2] eq 'PRIVMSG') {
54 print "Sent message!\n";
55 $timer = AnyEvent->timer (after => 1, cb => sub { $c->broadcast });
56 }
57 1
58 }
59 );
60
61 $con->send_srv (PRIVMSG => "Hello there i'm the cool Net::IRC3 test script!", 'elmex');
62
63 $con->connect ("localhost", 6667);
64 $con->register (qw/testbot testbot testbot/);
65
66 $c->wait;
67 undef $timer;
68
69 $con->disconnect;
28 70
29=head1 DESCRIPTION 71=head1 DESCRIPTION
30 72
31L<Net::IRC3> itself is a simple building block for an IRC client. 73The L<Net::IRC3> module consists of L<Net::IRC3::Connection>, L<Net::IRC3::Client::Connection>
74and L<Net::IRC3::Util>. L<Net::IRC3> only contains this documentation.
32It manages connections and parses and constructs IRC messages. 75It manages connections and parses and constructs IRC messages.
33 76
34L<Net::IRC3> is I<very> simple, if you don't want to care about 77L<Net::IRC3::Connection> is I<very> simple, if you don't want to care about
35all the other things that a client still has to do (like replying to 78all the other things that a client still has to do (like replying to
36PINGs and remembering who is on a channel), I recommend to read 79PINGs and remembering who is on a channel), I recommend to read
37the L<Net::IRC3::Client> page instead. 80the L<Net::IRC3::Client::Connection> page instead.
38 81
39Note that this module uses AnyEvent as it's IO event subsystem. 82Note that the *::Connection module uses AnyEvent as it's IO event subsystem.
40You can integrate Net::IRC3 into any application with a event system 83You can integrate them into any application with a event system
41that AnyEvent has support for (eg. L<Gtk2> or L<Event>). 84that AnyEvent has support for (eg. L<Gtk2> or L<Event>).
42 85
43=head1 EXAMPLES 86=head1 EXAMPLES
44 87
45See the samples/ directory for some examples on how to use Net::IRC3. 88See the samples/ directory for some examples on how to use Net::IRC3.
48 91
49Robin Redeker, C<< <elmex@ta-sa.org> >> 92Robin Redeker, C<< <elmex@ta-sa.org> >>
50 93
51=head1 SEE ALSO 94=head1 SEE ALSO
52 95
96L<Net::IRC3::Util>
97
53L<Net::IRC3::Connection> 98L<Net::IRC3::Connection>
54 99
55L<Net::IRC3::Client> 100L<Net::IRC3::Client::Connection>
56 101
57L<AnyEvent> 102L<AnyEvent>
58 103
59RFC 2812 - Internet Relay Chat: Client Protocol 104RFC 2812 - Internet Relay Chat: Client Protocol
60 105
98 143
99Thanks to Marc Lehmann for the new AnyEvent module! 144Thanks to Marc Lehmann for the new AnyEvent module!
100 145
101=head1 COPYRIGHT & LICENSE 146=head1 COPYRIGHT & LICENSE
102 147
103Copyright 2006 Robin Redker, all rights reserved. 148Copyright 2006 Robin Redeker, all rights reserved.
104 149
105This program is free software; you can redistribute it and/or modify it 150This program is free software; you can redistribute it and/or modify it
106under the same terms as Perl itself. 151under the same terms as Perl itself.
107 152
108=cut 153=cut

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines