| 1 |
elmex |
1.1 |
NAME |
| 2 |
|
|
Net::IRC3 - An IRC Protocol module which is event system independend |
| 3 |
|
|
|
| 4 |
|
|
VERSION |
| 5 |
elmex |
1.3 |
Version 0.2 |
| 6 |
elmex |
1.1 |
|
| 7 |
|
|
SYNOPSIS |
| 8 |
elmex |
1.2 |
use Net::IRC3; |
| 9 |
|
|
|
| 10 |
elmex |
1.1 |
my $irc3 = new Net::IRC3; |
| 11 |
|
|
|
| 12 |
elmex |
1.3 |
my $con = $irc3->connect ("test.not.at.irc.net", 6667); |
| 13 |
elmex |
1.1 |
|
| 14 |
|
|
... |
| 15 |
|
|
|
| 16 |
elmex |
1.2 |
DESCRIPTION |
| 17 |
|
|
Net::IRC3 itself is a simple building block for an IRC client. It |
| 18 |
|
|
manages connections and parses and constructs IRC messages. |
| 19 |
|
|
|
| 20 |
|
|
Net::IRC3 is *very* simple, if you don't want to care about all the |
| 21 |
|
|
other things that a client still has to do (like replying to PINGs and |
| 22 |
|
|
remembering who is on a channel), I recommend to read the |
| 23 |
|
|
Net::IRC3::Client page instead. |
| 24 |
|
|
|
| 25 |
|
|
METHODS |
| 26 |
|
|
new () |
| 27 |
|
|
This just creates a Net::IRC3 object, which is a management class |
| 28 |
|
|
for creating and managing connections. |
| 29 |
|
|
|
| 30 |
elmex |
1.3 |
connect ($host, $port) |
| 31 |
elmex |
1.2 |
Tries to open a socket to the host $host and the port $port. If |
| 32 |
|
|
successfull it will return a Net::IRC3::Connection object. If an |
| 33 |
|
|
error occured it will die (use eval to catch the exception). |
| 34 |
|
|
|
| 35 |
elmex |
1.3 |
connections () |
| 36 |
|
|
Returns a key value list, where the key is "$host:$port" and the |
| 37 |
|
|
value is the connection object. Only 'active' connections are |
| 38 |
|
|
returned. That means, if a connection is terminated somehow, it will |
| 39 |
|
|
also disappear from this list. |
| 40 |
|
|
|
| 41 |
|
|
connection ($host, $port) or connection ("$host:$port") |
| 42 |
|
|
Returns the Net::IRC3::Connection object for the $host $port pair. |
| 43 |
|
|
If no such connection exists, undef is returned. |
| 44 |
|
|
|
| 45 |
elmex |
1.2 |
FUNCTIONS |
| 46 |
|
|
These are some utility functions that might come in handy when handling |
| 47 |
|
|
the IRC protocol. |
| 48 |
|
|
|
| 49 |
elmex |
1.3 |
You can export these with eg.: |
| 50 |
|
|
|
| 51 |
|
|
use Net::IRC3 qw/parse_irc_msg/; |
| 52 |
|
|
|
| 53 |
elmex |
1.2 |
parse_irc_msg ($ircline) |
| 54 |
|
|
This method parses the $ircline, which is one line of the IRC |
| 55 |
|
|
protocol without the trailing "\015\012". |
| 56 |
|
|
|
| 57 |
|
|
It returns a hash which has the following entrys: |
| 58 |
|
|
|
| 59 |
|
|
prefix |
| 60 |
|
|
The message prefix. |
| 61 |
|
|
|
| 62 |
|
|
command |
| 63 |
|
|
The IRC command. |
| 64 |
|
|
|
| 65 |
|
|
params |
| 66 |
|
|
The parameters to the IRC command in a array reference, this |
| 67 |
|
|
includes the trailing parameter (the one after the ':' or the |
| 68 |
|
|
14th parameter). |
| 69 |
|
|
|
| 70 |
|
|
trailing |
| 71 |
|
|
This is set if there was a trailing parameter (the one after the |
| 72 |
|
|
':' or the 14th parameter). |
| 73 |
|
|
|
| 74 |
|
|
mk_msg ($prefix, $command, $trailing, @params) |
| 75 |
|
|
This function assembles a IRC message. The generated message will |
| 76 |
|
|
look like (pseudo code!) |
| 77 |
|
|
|
| 78 |
|
|
:<prefix> <command> <params> :<trail> |
| 79 |
|
|
|
| 80 |
|
|
Please refer to RFC 2812 how IRC messages normally look like. |
| 81 |
|
|
|
| 82 |
|
|
The prefix and the trailing string will be omitted if they are |
| 83 |
|
|
"undef". |
| 84 |
|
|
|
| 85 |
|
|
EXAMPLES: |
| 86 |
|
|
|
| 87 |
elmex |
1.3 |
mk_msg (undef, "PRIVMSG", "you suck!", "magnus"); |
| 88 |
elmex |
1.2 |
# will return: "PRIVMSG magnus :you suck!\015\012" |
| 89 |
|
|
|
| 90 |
elmex |
1.3 |
mk_msg (undef, "JOIN", undef, "#test"); |
| 91 |
elmex |
1.2 |
# will return: "JOIN #magnus\015\012" |
| 92 |
|
|
|
| 93 |
|
|
split_prefix ($prefix) |
| 94 |
|
|
This function splits an IRC user prefix as described by RFC 2817 |
| 95 |
|
|
into the three parts: nickname, user and host. Which will be |
| 96 |
|
|
returned as a list with that order. |
| 97 |
|
|
|
| 98 |
|
|
$prefix can also be a hash like it is returned by "parse_irc_msg". |
| 99 |
|
|
|
| 100 |
|
|
prefix_nick ($prefix) |
| 101 |
|
|
A shortcut to extract the nickname from the $prefix. |
| 102 |
|
|
|
| 103 |
|
|
$prefix can also be a hash like it is returned by "parse_irc_msg". |
| 104 |
|
|
|
| 105 |
|
|
prefix_user ($prefix) |
| 106 |
|
|
A shortcut to extract the username from the $prefix. |
| 107 |
|
|
|
| 108 |
|
|
$prefix can also be a hash like it is returned by "parse_irc_msg". |
| 109 |
|
|
|
| 110 |
|
|
prefix_host ($prefix) |
| 111 |
|
|
A shortcut to extract the hostname from the $prefix. |
| 112 |
|
|
|
| 113 |
|
|
$prefix can also be a hash like it is returned by "parse_irc_msg". |
| 114 |
|
|
|
| 115 |
elmex |
1.3 |
EXAMPLES |
| 116 |
|
|
See the samples/ directory for some examples on how to use Net::IRC3. |
| 117 |
elmex |
1.2 |
|
| 118 |
elmex |
1.3 |
AUTHOR |
| 119 |
|
|
Robin Redeker, "<elmex@ta-sa.org>" |
| 120 |
elmex |
1.2 |
|
| 121 |
elmex |
1.3 |
SEE ALSO |
| 122 |
|
|
Net::IRC3::Connection |
| 123 |
elmex |
1.2 |
|
| 124 |
elmex |
1.3 |
Net::IRC3::Client |
| 125 |
elmex |
1.2 |
|
| 126 |
elmex |
1.3 |
RFC 2812 - Internet Relay Chat: Client Protocol |
| 127 |
elmex |
1.1 |
|
| 128 |
|
|
BUGS |
| 129 |
elmex |
1.3 |
Please report any bugs or feature requests to "bug-net-irc3 at |
| 130 |
|
|
rt.cpan.org", or through the web interface at |
| 131 |
|
|
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-IRC3>. I will be |
| 132 |
|
|
notified, and then you'll automatically be notified of progress on your |
| 133 |
|
|
bug as I make changes. |
| 134 |
elmex |
1.1 |
|
| 135 |
|
|
SUPPORT |
| 136 |
elmex |
1.3 |
You can find documentation for this module with the perldoc command. |
| 137 |
elmex |
1.1 |
|
| 138 |
elmex |
1.3 |
perldoc Net::IRC3 |
| 139 |
elmex |
1.1 |
|
| 140 |
elmex |
1.3 |
You can also look for information at: |
| 141 |
elmex |
1.1 |
|
| 142 |
elmex |
1.3 |
* AnnoCPAN: Annotated CPAN documentation |
| 143 |
|
|
<http://annocpan.org/dist/Net-IRC3> |
| 144 |
elmex |
1.1 |
|
| 145 |
elmex |
1.3 |
* CPAN Ratings |
| 146 |
|
|
<http://cpanratings.perl.org/d/Net-IRC3> |
| 147 |
elmex |
1.1 |
|
| 148 |
elmex |
1.3 |
* RT: CPAN's request tracker |
| 149 |
|
|
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-IRC3> |
| 150 |
elmex |
1.1 |
|
| 151 |
elmex |
1.3 |
* Search CPAN |
| 152 |
|
|
<http://search.cpan.org/dist/Net-IRC3> |
| 153 |
elmex |
1.1 |
|
| 154 |
|
|
ACKNOWLEDGEMENTS |
| 155 |
elmex |
1.3 |
Thanks to Marc Lehmann for the new AnyEvent module! |
| 156 |
elmex |
1.1 |
|
| 157 |
|
|
COPYRIGHT & LICENSE |
| 158 |
elmex |
1.3 |
Copyright 2006 Robin Redker, all rights reserved. |
| 159 |
elmex |
1.1 |
|
| 160 |
elmex |
1.3 |
This program is free software; you can redistribute it and/or modify it |
| 161 |
|
|
under the same terms as Perl itself. |
| 162 |
elmex |
1.1 |
|