… | |
… | |
5 | |
5 | |
6 | our $ConnectionClass = 'Net::IRC3::Connection'; |
6 | our $ConnectionClass = 'Net::IRC3::Connection'; |
7 | |
7 | |
8 | =head1 NAME |
8 | =head1 NAME |
9 | |
9 | |
10 | Net::IRC3 - An IRC Protocol module which is event system independend |
10 | Net::IRC3 - An event system independend IRC protocol module |
11 | |
11 | |
12 | =head1 VERSION |
12 | =head1 VERSION |
13 | |
13 | |
14 | Version 0.21 |
14 | Version 0.5 |
15 | |
15 | |
16 | =cut |
16 | =cut |
17 | |
17 | |
18 | our $VERSION = '0.21'; |
18 | our $VERSION = '0.5'; |
19 | |
19 | |
20 | =head1 SYNOPSIS |
20 | =head1 SYNOPSIS |
21 | |
21 | |
|
|
22 | Using 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 | |
|
|
39 | Using 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 | |
31 | L<Net::IRC3> itself is a simple building block for an IRC client. |
73 | The L<Net::IRC3> module consists of L<Net::IRC3::Connection>, L<Net::IRC3::Client::Connection> |
|
|
74 | and L<Net::IRC3::Util>. L<Net::IRC3> only contains this documentation. |
32 | It manages connections and parses and constructs IRC messages. |
75 | It manages connections and parses and constructs IRC messages. |
33 | |
76 | |
34 | L<Net::IRC3> is I<very> simple, if you don't want to care about |
77 | L<Net::IRC3::Connection> is I<very> simple, if you don't want to care about |
35 | all the other things that a client still has to do (like replying to |
78 | all the other things that a client still has to do (like replying to |
36 | PINGs and remembering who is on a channel), I recommend to read |
79 | PINGs and remembering who is on a channel), I recommend to read |
37 | the L<Net::IRC3::Client> page instead. |
80 | the L<Net::IRC3::Client::Connection> page instead. |
38 | |
81 | |
39 | Note that this module uses AnyEvent as it's IO event subsystem. |
82 | Note that the *::Connection module uses AnyEvent as it's IO event subsystem. |
40 | You can integrate Net::IRC3 into any application with a event system |
83 | You can integrate them into any application with a event system |
41 | that AnyEvent has support for (eg. L<Gtk2> or L<Event>). |
84 | that AnyEvent has support for (eg. L<Gtk2> or L<Event>). |
42 | |
85 | |
43 | =head1 EXAMPLES |
86 | =head1 EXAMPLES |
44 | |
87 | |
45 | See the samples/ directory for some examples on how to use Net::IRC3. |
88 | See the samples/ directory for some examples on how to use Net::IRC3. |
… | |
… | |
48 | |
91 | |
49 | Robin Redeker, C<< <elmex@ta-sa.org> >> |
92 | Robin Redeker, C<< <elmex@ta-sa.org> >> |
50 | |
93 | |
51 | =head1 SEE ALSO |
94 | =head1 SEE ALSO |
52 | |
95 | |
|
|
96 | L<Net::IRC3::Util> |
|
|
97 | |
53 | L<Net::IRC3::Connection> |
98 | L<Net::IRC3::Connection> |
54 | |
99 | |
55 | L<Net::IRC3::Client> |
100 | L<Net::IRC3::Client::Connection> |
56 | |
101 | |
57 | L<AnyEvent> |
102 | L<AnyEvent> |
58 | |
103 | |
59 | RFC 2812 - Internet Relay Chat: Client Protocol |
104 | RFC 2812 - Internet Relay Chat: Client Protocol |
60 | |
105 | |
… | |
… | |
98 | |
143 | |
99 | Thanks to Marc Lehmann for the new AnyEvent module! |
144 | Thanks to Marc Lehmann for the new AnyEvent module! |
100 | |
145 | |
101 | =head1 COPYRIGHT & LICENSE |
146 | =head1 COPYRIGHT & LICENSE |
102 | |
147 | |
103 | Copyright 2006 Robin Redker, all rights reserved. |
148 | Copyright 2006 Robin Redeker, all rights reserved. |
104 | |
149 | |
105 | This program is free software; you can redistribute it and/or modify it |
150 | This program is free software; you can redistribute it and/or modify it |
106 | under the same terms as Perl itself. |
151 | under the same terms as Perl itself. |
107 | |
152 | |
108 | =cut |
153 | =cut |