| 1 | # You may distribute under the terms of either the GNU General Public License | ||||||||||||||||||||||||||||
| 2 | # or the Artistic License (the same terms as Perl itself) | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | # (C) Paul Evans, 2008-2017 -- leonerd@leonerd.org.uk | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | package Net::Async::IRC; | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 7 | our $VERSION = '0.11'; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | # We need to use C3 MRO to make the ->isupport etc.. methods work properly | ||||||||||||||||||||||||||||
| 14 | 7 | ▶ | use mro 'c3'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 7 | ▶ | use base qw( Net::Async::IRC::Protocol Protocol::IRC::Client ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 7 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 7 | ▶ | use Socket qw( SOCK_STREAM ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 7 | ▶ | use constant HAVE_MSWIN32 => ( $^O eq "MSWin32" ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | =head1 NAME | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | C<Net::Async::IRC> - use IRC with C<IO::Async> | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | use IO::Async::Loop; | ||||||||||||||||||||||||||||
| 30 | use Net::Async::IRC; | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | my $loop = IO::Async::Loop->new; | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | my $irc = Net::Async::IRC->new( | ||||||||||||||||||||||||||||
| 35 | on_message_text => sub { | ||||||||||||||||||||||||||||
| 36 | my ( $self, $message, $hints ) = @_; | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | print "$hints->{prefix_name} says: $hints->{text}\n"; | ||||||||||||||||||||||||||||
| 39 | }, | ||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | $loop->add( $irc ); | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | $irc->login( | ||||||||||||||||||||||||||||
| 45 | nick => "MyName", | ||||||||||||||||||||||||||||
| 46 | host => "irc.example.org", | ||||||||||||||||||||||||||||
| 47 | )->get; | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | $irc->do_PRIVMSG( target => "YourName", text => "Hello world!" ); | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | $loop->run; | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | This object class implements an asynchronous IRC client, for use in programs | ||||||||||||||||||||||||||||
| 56 | based on L<IO::Async>. | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | Most of the actual IRC message handling behaviour is implemented by the parent | ||||||||||||||||||||||||||||
| 59 | class L<Net::Async::IRC::Protocol>. | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | Most of the behaviour related to being an IRC client is implemented by the | ||||||||||||||||||||||||||||
| 62 | parent class L<Protocol::IRC::Client>. | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | The following documentation may make mention of these above two parent | ||||||||||||||||||||||||||||
| 65 | classes; the reader should make reference to them when required. | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =cut | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | sub new | ||||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||
| 71 | 7 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=3.1
Pod
documented
| |||||||||||||||||||||||||||||
| 72 | 7 | my %args = @_; | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 7 | my $on_closed = delete $args{on_closed}; | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | return $class->SUPER::new( | ||||||||||||||||||||||||||||
| 77 | %args, | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | on_closed => sub { | ||||||||||||||||||||||||||||
| 80 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | if( $self->{on_login_f} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | 0 | $_->fail( "Closed" ) for @{ $self->{on_login_f} }; | |||||||||||||||||||||||||||
| 84 | 0 | undef $self->{on_login_f}; | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 0 | ▶ | $on_closed->( $self ) if $on_closed; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | }, | ||||||||||||||||||||||||||||
| 89 | 7 | ); | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | sub _init | ||||||||||||||||||||||||||||
| 93 | { | ||||||||||||||||||||||||||||
| 94 | 7 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_init: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||
| 95 | 7 | $self->SUPER::_init( @_ ); | |||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | $self->{user} = $ENV{LOGNAME} || | ||||||||||||||||||||||||||||
| 98 | 7 | ▶ | ( HAVE_MSWIN32 ? Win32::LoginName() : getpwuid($>) ); | ||||||||||||||||||||||||||
|
Condition33%1/3
$ENV{'LOGNAME'} || getpwuid $>
MC/DC0%0/2
$ENV{'LOGNAME'} || getpwuid $>
$ENV{'LOGNAME'}
getpwuid $>
Truth table33%1/3
A || B
A= $ENV{'LOGNAME'}B= getpwuid $>
| |||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 7 | $self->{realname} = "Net::Async::IRC client $VERSION"; | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | =head1 PARAMETERS | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | The following named parameters may be passed to C<new> or C<configure>: | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | =over 8 | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | =item nick => STRING | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | =item user => STRING | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | =item realname => STRING | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | Connection details. See also C<connect>, C<login>. | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | If C<user> is not supplied, it will default to either C<$ENV{LOGNAME}> or the | ||||||||||||||||||||||||||||
| 118 | current user's name as supplied by C<getpwuid()> or C<Win32::LoginName()>. | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | If unconnected, changing these properties will set the default values to use | ||||||||||||||||||||||||||||
| 121 | when logging in. | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | If logged in, changing the C<nick> property is equivalent to calling | ||||||||||||||||||||||||||||
| 124 | C<change_nick>. Changing the other properties will not take effect until the | ||||||||||||||||||||||||||||
| 125 | next login. | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | =item use_caps => ARRAY of STRING | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | Attempts to negotiate IRC v3.1 CAP at connect time. The array gives the names | ||||||||||||||||||||||||||||
| 130 | of capabilities which will be requested, if the server supports them. | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | =back | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | =cut | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | sub configure | ||||||||||||||||||||||||||||
| 137 | { | ||||||||||||||||||||||||||||
| 138 | 9 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
configure: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 139 | 9 | my %args = @_; | |||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 9 | for (qw( user realname use_caps )) { | |||||||||||||||||||||||||||
| 142 | 27 | ▶ | $self->{$_} = delete $args{$_} if exists $args{$_}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 9 | ▶ | if( exists $args{nick} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | 1 | $self->_set_nick( delete $args{nick} ); | |||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 9 | $self->SUPER::configure( %args ); | |||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | =head1 METHODS | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | The following methods documented with a trailing call to C<< ->get >> return | ||||||||||||||||||||||||||||
| 155 | L<Future> instances. | ||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | =cut | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | =head2 connect | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | $irc = $irc->connect( %args )->get | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | Connects to the IRC server. This method does not perform the complete IRC | ||||||||||||||||||||||||||||
| 164 | login sequence; for that see instead the C<login> method. The returned | ||||||||||||||||||||||||||||
| 165 | L<Future> will yield the C<$irc> instance itself, to make chaining easier. | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | =over 8 | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | =item host => STRING | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | Hostname of the IRC server. | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | =item service => STRING or NUMBER | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | Optional. Port number or service name of the IRC server. Defaults to 6667. | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | =back | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | Any other arguments are passed into the underlying C<IO::Async::Loop> | ||||||||||||||||||||||||||||
| 180 | C<connect> method. | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | $irc->connect( %args ) | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | The following additional arguments are used to provide continuations when not | ||||||||||||||||||||||||||||
| 185 | returning a Future. | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | =over 8 | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | =item on_connected => CODE | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | Continuation to invoke once the connection has been established. Usually used | ||||||||||||||||||||||||||||
| 192 | by the C<login> method to perform the actual login sequence. | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | $on_connected->( $irc ) | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | =item on_error => CODE | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | Continuation to invoke in the case of an error preventing the connection from | ||||||||||||||||||||||||||||
| 199 | taking place. | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | $on_error->( $errormsg ) | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | =back | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | =cut | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | # TODO: Most of this needs to be moved into an abstract Net::Async::Connection role | ||||||||||||||||||||||||||||
| 208 | sub connect | ||||||||||||||||||||||||||||
| 209 | { | ||||||||||||||||||||||||||||
| 210 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
connect: called CC=5 SCAR=24.4
Pod
documented
| |||||||||||||||||||||||||||||
| 211 | 6 | my %args = @_; | |||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | # Largely for unit testing | ||||||||||||||||||||||||||||
| 214 | 6 | ▶ | return $self->{connect_f} ||= Future->new->done( $self ) if | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"connect_f"} ||= "Future"->new->done($self)
MC/DC0%0/2
$self->{"connect_f"} ||= "Future"->new->done($self)
$self->{"connect_f"}
"Future"->new->done($self)
Truth table66%2/3
A ||= B
A= $self->{"connect_f"}B= "Future"->new->done($self)
| |||||||||||||||||||||||||||||
| 215 | $self->read_handle; | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | 2 | my $on_error = delete $args{on_error}; | |||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | 2 | ▶ | $args{service} ||= "6667"; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args{"service"} ||= 6667
MC/DC0%0/1
$args{"service"} ||= 6667
$args{"service"}
Truth table50%1/2
A
A= $args{"service"}
| |||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | return $self->{connect_f} ||= $self->SUPER::connect( | ||||||||||||||||||||||||||||
| 222 | %args, | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | on_resolve_error => sub { | ||||||||||||||||||||||||||||
| 225 | 0 | ▶ | my ( $msg ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 226 | 0 | chomp $msg; | |||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | if( $args{on_resolve_error} ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 229 | 0 | $args{on_resolve_error}->( $msg ); | |||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||
| 231 | elsif( $on_error ) { | ||||||||||||||||||||||||||||
| 232 | 0 | $on_error->( "Cannot resolve - $msg" ); | |||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | }, | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | on_connect_error => sub { | ||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if( $args{on_connect_error} ) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 238 | 0 | $args{on_connect_error}->( @_ ); | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | elsif( $on_error ) { | ||||||||||||||||||||||||||||
| 241 | 0 | $on_error->( "Cannot connect" ); | |||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | }, | ||||||||||||||||||||||||||||
| 244 | 2 | ▶ | )->on_fail( sub { undef $self->{connect_f} } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=2.0
Condition33%1/3
$self->{"connect_f"} ||= $self->SUPER::connect(%args, "on_resolve_error", sub {
my($msg) = @_;
chomp $msg;
if ($args{"on_resolve_error"}) {
$args{"on_resolve_error"}->($msg);
}
elsif ($on_error) {
&$on_error("Cannot resolve - $msg");
};
}
, "on_connect_error", sub {
if ($args{"on_connect_error"}) {
$args{"on_connect_error"}->(@_);
}
elsif ($on_error) {
&$on_error("Cannot connect");
};
}
)->on_fail(sub {
undef $self->{"connect_f"};
}
)
MC/DC0%0/2
$self->{"connect_f"} ||= $self->SUPER::connect(%args, "on_resolve_error", sub {
my($msg) = @_;
chomp $msg;
if ($args{"on_resolve_error"}) {
$args{"on_resolve_error"}->($msg);
}
elsif ($on_error) {
&$on_error("Cannot resolve - $msg");
};
}
, "on_connect_error", sub {
if ($args{"on_connect_error"}) {
$args{"on_connect_error"}->(@_);
}
elsif ($on_error) {
&$on_error("Cannot connect");
};
}
)->on_fail(sub {
undef $self->{"connect_f"};
}
)
$self->{"connect_f"}
$self->SUPER::connect(%args, "on_resolve_error", sub {
my($msg) = @_;
chomp $msg;
if ($args{"on_resolve_error"}) {
$args{"on_resolve_error"}->($msg);
}
elsif ($on_error) {
&$on_error("Cannot resolve - $msg");
};
}
, "on_connect_error", sub {
if ($args{"on_connect_error"}) {
$args{"on_connect_error"}->(@_);
}
elsif ($on_error) {
&$on_error("Cannot connect");
};
}
)->on_fail(sub {
undef $self->{"connect_f"};
}
)
Truth table33%1/3
A ||= B
A= $self->{"connect_f"}B= $self->SUPER::connect(%args, "on_resolve_error", sub {
my($msg) = @_;
chomp $msg;
if ($args{"on_resolve_error"}) {
$args{"on_resolve_error"}->($msg);
}
elsif ($on_error) {
&$on_error("Cannot resolve - $msg");
};
}
, "on_connect_error", sub {
if ($args{"on_connect_error"}) {
$args{"on_connect_error"}->(@_);
}
elsif ($on_error) {
&$on_error("Cannot connect");
};
}
)->on_fail(sub {
undef $self->{"connect_f"};
}
)
| |||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | =head2 login | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | $irc = $irc->login( %args )->get | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | Logs in to the IRC network, connecting first using the C<connect> method if | ||||||||||||||||||||||||||||
| 252 | required. Takes the following named arguments: | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | =over 8 | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | =item nick => STRING | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | =item user => STRING | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | =item realname => STRING | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | IRC connection details. Defaults can be set with the C<new> or C<configure> | ||||||||||||||||||||||||||||
| 263 | methods. | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | =item pass => STRING | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | Server password to connect with. | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | =back | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | Any other arguments that are passed, are forwarded to the C<connect> method if | ||||||||||||||||||||||||||||
| 272 | it is required; i.e. if C<login> is invoked when not yet connected to the | ||||||||||||||||||||||||||||
| 273 | server. | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | $irc->login( %args ) | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | The following additional arguments are used to provide continuations when not | ||||||||||||||||||||||||||||
| 278 | returning a Future. | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | =over 8 | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | =item on_login => CODE | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | A continuation to invoke once login is successful. | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | $on_login->( $irc ) | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | =back | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | =cut | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | sub login | ||||||||||||||||||||||||||||
| 293 | { | ||||||||||||||||||||||||||||
| 294 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
login: called CC=10 SCAR=24.0
Pod
documented
| |||||||||||||||||||||||||||||
| 295 | 4 | my %args = @_; | |||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | 4 | ▶ | my $nick = delete $args{nick} || $self->{nick} or croak "Need a login nick"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
delete $args{'nick'} || $self->{'nick'}
MC/DC0%0/2
delete $args{'nick'} || $self->{'nick'}
delete $args{'nick'}
$self->{'nick'}
Truth table66%2/3
A || B
A= delete $args{'nick'}B= $self->{'nick'}
| |||||||||||||||||||||||||||||
| 298 | 4 | ▶ | my $user = delete $args{user} || $self->{user} or croak "Need a login user"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
delete $args{'user'} || $self->{'user'}
MC/DC0%0/2
delete $args{'user'} || $self->{'user'}
delete $args{'user'}
$self->{'user'}
Truth table66%2/3
A || B
A= delete $args{'user'}B= $self->{'user'}
| |||||||||||||||||||||||||||||
| 299 | 4 | ▶ | my $realname = delete $args{realname} || $self->{realname}; | ||||||||||||||||||||||||||
|
Condition66%2/3
delete $args{'realname'} || $self->{'realname'}
MC/DC0%0/2
delete $args{'realname'} || $self->{'realname'}
delete $args{'realname'}
$self->{'realname'}
Truth table66%2/3
A || B
A= delete $args{'realname'}B= $self->{'realname'}
| |||||||||||||||||||||||||||||
| 300 | 4 | my $pass = delete $args{pass}; | |||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | 4 | ▶ | if( !defined $self->{nick} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 303 | 3 | $self->_set_nick( $nick ); | |||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | 4 | my $on_login = delete $args{on_login}; | |||||||||||||||||||||||||||
| 307 | 4 | ▶ | !defined $on_login or ref $on_login eq "CODE" or | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $on_login or ref $on_login eq "CODE"
MC/DC0%0/2
not defined $on_login or ref $on_login eq "CODE"
not defined $on_login
ref $on_login eq "CODE"
Truth table66%2/3
not(A) or B
A= not defined $on_loginB= ref $on_login eq "CODE"
| |||||||||||||||||||||||||||||
| 308 | croak "Expected 'on_login' to be a CODE reference"; | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | return $self->{login_f} ||= $self->connect( %args )->then( sub { | ||||||||||||||||||||||||||||
| 311 | 4 | ▶ | $self->send_message( "CAP", undef, "LS" ) if $self->{use_caps}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | 4 | ▶ | $self->send_message( "PASS", undef, $pass ) if defined $pass; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 314 | 4 | $self->send_message( "USER", undef, $user, "0", "*", $realname ); | |||||||||||||||||||||||||||
| 315 | 4 | $self->send_message( "NICK", undef, $nick ); | |||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | 4 | my $f = $self->loop->new_future; | |||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | 4 | push @{ $self->{on_login_f} }, $f; | |||||||||||||||||||||||||||
| 320 | 4 | ▶ | $f->on_done( $on_login ) if $on_login; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | 4 | return $f; | |||||||||||||||||||||||||||
| 323 | 4 | ▶ | })->on_fail( sub { undef $self->{login_f} } ); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=2.0
Condition33%1/3
$self->{"login_f"} ||= $self->connect(%args)->then(sub {
$self->send_message("CAP", undef, "LS") if $self->{"use_caps"};
$self->send_message("PASS", undef, $pass) if defined $pass;
$self->send_message("USER", undef, $user, 0, "*", $realname);
$self->send_message("NICK", undef, $nick);
my $f = $self->loop->new_future;
push @{$$self{"on_login_f"};}, $f;
$f->on_done($on_login) if $on_login;
return $f;
}
)->on_fail(sub {
undef $self->{"login_f"};
}
)
MC/DC0%0/2
$self->{"login_f"} ||= $self->connect(%args)->then(sub {
$self->send_message("CAP", undef, "LS") if $self->{"use_caps"};
$self->send_message("PASS", undef, $pass) if defined $pass;
$self->send_message("USER", undef, $user, 0, "*", $realname);
$self->send_message("NICK", undef, $nick);
my $f = $self->loop->new_future;
push @{$$self{"on_login_f"};}, $f;
$f->on_done($on_login) if $on_login;
return $f;
}
)->on_fail(sub {
undef $self->{"login_f"};
}
)
$self->{"login_f"}
$self->connect(%args)->then(sub {
$self->send_message("CAP", undef, "LS") if $self->{"use_caps"};
$self->send_message("PASS", undef, $pass) if defined $pass;
$self->send_message("USER", undef, $user, 0, "*", $realname);
$self->send_message("NICK", undef, $nick);
my $f = $self->loop->new_future;
push @{$$self{"on_login_f"};}, $f;
$f->on_done($on_login) if $on_login;
return $f;
}
)->on_fail(sub {
undef $self->{"login_f"};
}
)
Truth table33%1/3
A ||= B
A= $self->{"login_f"}B= $self->connect(%args)->then(sub {
$self->send_message("CAP", undef, "LS") if $self->{"use_caps"};
$self->send_message("PASS", undef, $pass) if defined $pass;
$self->send_message("USER", undef, $user, 0, "*", $realname);
$self->send_message("NICK", undef, $nick);
my $f = $self->loop->new_future;
push @{$$self{"on_login_f"};}, $f;
$f->on_done($on_login) if $on_login;
return $f;
}
)->on_fail(sub {
undef $self->{"login_f"};
}
)
| |||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | =head2 change_nick | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | $irc->change_nick( $newnick ) | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | Requests to change the nick. If unconnected, the change happens immediately | ||||||||||||||||||||||||||||
| 331 | to the stored defaults. If logged in, sends a C<NICK> command to the server, | ||||||||||||||||||||||||||||
| 332 | which may suceed or fail at a later point. | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | =cut | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | sub change_nick | ||||||||||||||||||||||||||||
| 337 | { | ||||||||||||||||||||||||||||
| 338 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
change_nick: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||
| 339 | 3 | my ( $newnick ) = @_; | |||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | 3 | ▶ | if( !$self->is_connected ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 342 | 0 | $self->_set_nick( $newnick ); | |||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||
| 344 | else { | ||||||||||||||||||||||||||||
| 345 | 3 | $self->send_message( "NICK", undef, $newnick ); | |||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | ############################ | ||||||||||||||||||||||||||||
| 350 | # Message handling methods # | ||||||||||||||||||||||||||||
| 351 | ############################ | ||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | =head1 IRC v3.1 CAPABILITIES | ||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | The following methods relate to IRC v3.1 capabilities negotiations. | ||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | =cut | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | sub on_message_cap_LS | ||||||||||||||||||||||||||||
| 360 | { | ||||||||||||||||||||||||||||
| 361 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
on_message_cap_LS: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 362 | 1 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | 1 | my $supported = $self->{caps_supported} = $hints->{caps}; | |||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | 1 | my @request = grep { $supported->{$_} } @{$self->{use_caps}}; | |||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | 1 | ▶ | if( @request ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 369 | 1 | $self->{caps_enabled} = { map { $_ => undef } @request }; | |||||||||||||||||||||||||||
| 370 | 1 | $self->send_message( "CAP", undef, "REQ", join( " ", @request ) ); | |||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||
| 372 | else { | ||||||||||||||||||||||||||||
| 373 | 0 | $self->send_message( "CAP", undef, "END" ); | |||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||
| 376 | 1 | return 1; | |||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | 7 | *on_message_cap_ACK = *on_message_cap_NAK = \&_on_message_cap_reply; | |||||||||||||||||||||||||||
| 380 | sub _on_message_cap_reply | ||||||||||||||||||||||||||||
| 381 | { | ||||||||||||||||||||||||||||
| 382 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_on_message_cap_reply: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 383 | 1 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||
| 384 | 1 | my $ack = $hints->{verb} eq "ACK"; | |||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | 1 | $self->{caps_enabled}{$_} = $ack for keys %{ $hints->{caps} }; | |||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | # Are any outstanding | ||||||||||||||||||||||||||||
| 389 | 1 | ▶ | !defined and return 1 for values %{ $self->{caps_enabled} }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | 1 | $self->send_message( "CAP", undef, "END" ); | |||||||||||||||||||||||||||
| 392 | 1 | return 1; | |||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | =head2 caps_supported | ||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | $caps = $irc->caps_supported | ||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||
| 399 | Returns a HASH whose keys give the capabilities listed by the server as | ||||||||||||||||||||||||||||
| 400 | supported in its C<CAP LS> response. If the server ignored the C<CAP> | ||||||||||||||||||||||||||||
| 401 | negotiation then this method returns C<undef>. | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | =cut | ||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | sub caps_supported | ||||||||||||||||||||||||||||
| 406 | { | ||||||||||||||||||||||||||||
| 407 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
caps_supported: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 408 | 2 | return $self->{caps_supported}; | |||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||
| 411 | =head2 cap_supported | ||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | $supported = $irc->cap_supported( $cap ) | ||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | Returns a boolean indicating if the server supports the named capability. | ||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||
| 417 | =cut | ||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||
| 419 | sub cap_supported | ||||||||||||||||||||||||||||
| 420 | { | ||||||||||||||||||||||||||||
| 421 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
cap_supported: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 422 | 1 | my ( $cap ) = @_; | |||||||||||||||||||||||||||
| 423 | 1 | return !!$self->{caps_supported}{$cap}; | |||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | =head2 caps_enabled | ||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | $caps = $irc->caps_enabled | ||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||
| 430 | Returns a HASH whose keys give the capabilities successfully enabled by the | ||||||||||||||||||||||||||||
| 431 | server as part of the C<CAP REQ> login sequence. If the server ignored the | ||||||||||||||||||||||||||||
| 432 | C<CAP> negotiation then this method returns C<undef>. | ||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | =cut | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | sub caps_enabled | ||||||||||||||||||||||||||||
| 437 | { | ||||||||||||||||||||||||||||
| 438 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
caps_enabled: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 439 | 2 | return $self->{caps_enabled}; | |||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||
| 442 | =head2 cap_enabled | ||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||
| 444 | $enabled = $irc->cap_enabled( $cap ) | ||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | Returns a boolean indicating if the client successfully enabled the named | ||||||||||||||||||||||||||||
| 447 | capability. | ||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | =cut | ||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | sub cap_enabled | ||||||||||||||||||||||||||||
| 452 | { | ||||||||||||||||||||||||||||
| 453 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
cap_enabled: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 454 | 1 | my ( $cap ) = @_; | |||||||||||||||||||||||||||
| 455 | 1 | return !!$self->{caps_enabled}{$cap}; | |||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | sub on_message_NICK | ||||||||||||||||||||||||||||
| 459 | { | ||||||||||||||||||||||||||||
| 460 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
on_message_NICK: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 461 | 1 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||
| 463 | 1 | ▶ | if( $hints->{prefix_is_me} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 464 | 1 | $self->_set_nick( $hints->{new_nick} ); | |||||||||||||||||||||||||||
| 465 | 1 | return 1; | |||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||
| 468 | 0 | return 0; | |||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||
| 471 | sub on_message_RPL_WELCOME | ||||||||||||||||||||||||||||
| 472 | { | ||||||||||||||||||||||||||||
| 473 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
on_message_RPL_WELCOME: called CC=4 SCAR=14.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 474 | 4 | my ( $message ) = @_; | |||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||
| 476 | # set our nick to be what the server logged us in as | ||||||||||||||||||||||||||||
| 477 | 4 | $self->_set_nick( $message->{args}[0] ); | |||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||
| 479 | 4 | ▶ | if( $self->{on_login_f} and @{ $self->{on_login_f} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"on_login_f"} and @{$self->{"on_login_f"};}
MC/DC0%0/2
$self->{"on_login_f"} and @{$self->{"on_login_f"};}
$self->{"on_login_f"}
@{$self->{"on_login_f"};}
Truth table33%1/3
A and B
A= $self->{"on_login_f"}B= @{$self->{"on_login_f"};}
| |||||||||||||||||||||||||||||
| 480 | 4 | my @futures = @{ $self->{on_login_f} }; | |||||||||||||||||||||||||||
| 481 | 4 | undef $self->{on_login_f}; | |||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||
| 483 | 4 | foreach my $f ( @futures ) { | |||||||||||||||||||||||||||
| 484 | 4 | $f->done( $self ); | |||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||
| 488 | # Don't eat it | ||||||||||||||||||||||||||||
| 489 | 4 | return 0; | |||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||
| 492 | =head1 MESSAGE-WRAPPING METHODS | ||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||
| 494 | The following methods are all inherited from L<Protocol::IRC::Client> but are | ||||||||||||||||||||||||||||
| 495 | mentioned again for convenient. For further details see the documentation in | ||||||||||||||||||||||||||||
| 496 | the parent module. | ||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||
| 498 | In particular, each method returns a L<Future> instance. | ||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | =cut | ||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||
| 502 | =head2 do_PRIVMSG | ||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||
| 504 | =head2 do_NOTICE | ||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||
| 506 | $irc->do_PRIVMSG( target => $target, text => $text )->get | ||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||
| 508 | $irc->do_NOTICE( target => $target, text => $text )->get | ||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||
| 510 | Sends a C<PRIVMSG> or C<NOITICE> command. | ||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||
| 512 | =cut | ||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||
| 514 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||
| 516 | =over 4 | ||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||
| 518 | =item * | ||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||
| 520 | L<http://tools.ietf.org/html/rfc2812> - Internet Relay Chat: Client Protocol | ||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||
| 522 | =back | ||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||
| 524 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||
| 526 | Paul Evans <leonerd@leonerd.org.uk> | ||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||
| 528 | =cut | ||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||
| 530 | 7 | 0x55AA; | |||||||||||||||||||||||||||