.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Net::Async::IRC 3pm" .TH Net::Async::IRC 3pm "2018-07-02" "perl v5.26.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" "Net::Async::IRC" \- use IRC with "IO::Async" .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use IO::Async::Loop; \& use Net::Async::IRC; \& \& my $loop = IO::Async::Loop\->new; \& \& my $irc = Net::Async::IRC\->new( \& on_message_text => sub { \& my ( $self, $message, $hints ) = @_; \& \& print "$hints\->{prefix_name} says: $hints\->{text}\en"; \& }, \& ); \& \& $loop\->add( $irc ); \& \& $irc\->login( \& nick => "MyName", \& host => "irc.example.org", \& )\->get; \& \& $irc\->do_PRIVMSG( target => "YourName", text => "Hello world!" ); \& \& $loop\->run; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This object class implements an asynchronous \s-1IRC\s0 client, for use in programs based on IO::Async. .PP Most of the actual \s-1IRC\s0 message handling behaviour is implemented by the parent class Net::Async::IRC::Protocol. .PP Most of the behaviour related to being an \s-1IRC\s0 client is implemented by the parent class Protocol::IRC::Client. .PP The following documentation may make mention of these above two parent classes; the reader should make reference to them when required. .SH "PARAMETERS" .IX Header "PARAMETERS" The following named parameters may be passed to \f(CW\*(C`new\*(C'\fR or \f(CW\*(C`configure\*(C'\fR: .IP "nick => \s-1STRING\s0" 8 .IX Item "nick => STRING" .PD 0 .IP "user => \s-1STRING\s0" 8 .IX Item "user => STRING" .IP "realname => \s-1STRING\s0" 8 .IX Item "realname => STRING" .PD Connection details. See also \f(CW\*(C`connect\*(C'\fR, \f(CW\*(C`login\*(C'\fR. .Sp If \f(CW\*(C`user\*(C'\fR is not supplied, it will default to either \f(CW$ENV{LOGNAME}\fR or the current user's name as supplied by \f(CW\*(C`getpwuid()\*(C'\fR or \f(CW\*(C`Win32::LoginName()\*(C'\fR. .Sp If unconnected, changing these properties will set the default values to use when logging in. .Sp If logged in, changing the \f(CW\*(C`nick\*(C'\fR property is equivalent to calling \&\f(CW\*(C`change_nick\*(C'\fR. Changing the other properties will not take effect until the next login. .IP "use_caps => \s-1ARRAY\s0 of \s-1STRING\s0" 8 .IX Item "use_caps => ARRAY of STRING" Attempts to negotiate \s-1IRC\s0 v3.1 \s-1CAP\s0 at connect time. The array gives the names of capabilities which will be requested, if the server supports them. .SH "METHODS" .IX Header "METHODS" The following methods documented with a trailing call to \f(CW\*(C`\->get\*(C'\fR return Future instances. .SS "connect" .IX Subsection "connect" .Vb 1 \& $irc = $irc\->connect( %args )\->get .Ve .PP Connects to the \s-1IRC\s0 server. This method does not perform the complete \s-1IRC\s0 login sequence; for that see instead the \f(CW\*(C`login\*(C'\fR method. The returned Future will yield the \f(CW$irc\fR instance itself, to make chaining easier. .IP "host => \s-1STRING\s0" 8 .IX Item "host => STRING" Hostname of the \s-1IRC\s0 server. .IP "service => \s-1STRING\s0 or \s-1NUMBER\s0" 8 .IX Item "service => STRING or NUMBER" Optional. Port number or service name of the \s-1IRC\s0 server. Defaults to 6667. .PP Any other arguments are passed into the underlying \f(CW\*(C`IO::Async::Loop\*(C'\fR \&\f(CW\*(C`connect\*(C'\fR method. .PP .Vb 1 \& $irc\->connect( %args ) .Ve .PP The following additional arguments are used to provide continuations when not returning a Future. .IP "on_connected => \s-1CODE\s0" 8 .IX Item "on_connected => CODE" Continuation to invoke once the connection has been established. Usually used by the \f(CW\*(C`login\*(C'\fR method to perform the actual login sequence. .Sp .Vb 1 \& $on_connected\->( $irc ) .Ve .IP "on_error => \s-1CODE\s0" 8 .IX Item "on_error => CODE" Continuation to invoke in the case of an error preventing the connection from taking place. .Sp .Vb 1 \& $on_error\->( $errormsg ) .Ve .SS "login" .IX Subsection "login" .Vb 1 \& $irc = $irc\->login( %args )\->get .Ve .PP Logs in to the \s-1IRC\s0 network, connecting first using the \f(CW\*(C`connect\*(C'\fR method if required. Takes the following named arguments: .IP "nick => \s-1STRING\s0" 8 .IX Item "nick => STRING" .PD 0 .IP "user => \s-1STRING\s0" 8 .IX Item "user => STRING" .IP "realname => \s-1STRING\s0" 8 .IX Item "realname => STRING" .PD \&\s-1IRC\s0 connection details. Defaults can be set with the \f(CW\*(C`new\*(C'\fR or \f(CW\*(C`configure\*(C'\fR methods. .IP "pass => \s-1STRING\s0" 8 .IX Item "pass => STRING" Server password to connect with. .PP Any other arguments that are passed, are forwarded to the \f(CW\*(C`connect\*(C'\fR method if it is required; i.e. if \f(CW\*(C`login\*(C'\fR is invoked when not yet connected to the server. .PP .Vb 1 \& $irc\->login( %args ) .Ve .PP The following additional arguments are used to provide continuations when not returning a Future. .IP "on_login => \s-1CODE\s0" 8 .IX Item "on_login => CODE" A continuation to invoke once login is successful. .Sp .Vb 1 \& $on_login\->( $irc ) .Ve .SS "change_nick" .IX Subsection "change_nick" .Vb 1 \& $irc\->change_nick( $newnick ) .Ve .PP Requests to change the nick. If unconnected, the change happens immediately to the stored defaults. If logged in, sends a \f(CW\*(C`NICK\*(C'\fR command to the server, which may suceed or fail at a later point. .SH "IRC v3.1 CAPABILITIES" .IX Header "IRC v3.1 CAPABILITIES" The following methods relate to \s-1IRC\s0 v3.1 capabilities negotiations. .SS "caps_supported" .IX Subsection "caps_supported" .Vb 1 \& $caps = $irc\->caps_supported .Ve .PP Returns a \s-1HASH\s0 whose keys give the capabilities listed by the server as supported in its \f(CW\*(C`CAP LS\*(C'\fR response. If the server ignored the \f(CW\*(C`CAP\*(C'\fR negotiation then this method returns \f(CW\*(C`undef\*(C'\fR. .SS "cap_supported" .IX Subsection "cap_supported" .Vb 1 \& $supported = $irc\->cap_supported( $cap ) .Ve .PP Returns a boolean indicating if the server supports the named capability. .SS "caps_enabled" .IX Subsection "caps_enabled" .Vb 1 \& $caps = $irc\->caps_enabled .Ve .PP Returns a \s-1HASH\s0 whose keys give the capabilities successfully enabled by the server as part of the \f(CW\*(C`CAP REQ\*(C'\fR login sequence. If the server ignored the \&\f(CW\*(C`CAP\*(C'\fR negotiation then this method returns \f(CW\*(C`undef\*(C'\fR. .SS "cap_enabled" .IX Subsection "cap_enabled" .Vb 1 \& $enabled = $irc\->cap_enabled( $cap ) .Ve .PP Returns a boolean indicating if the client successfully enabled the named capability. .SH "MESSAGE-WRAPPING METHODS" .IX Header "MESSAGE-WRAPPING METHODS" The following methods are all inherited from Protocol::IRC::Client but are mentioned again for convenient. For further details see the documentation in the parent module. .PP In particular, each method returns a Future instance. .SS "do_PRIVMSG" .IX Subsection "do_PRIVMSG" .SS "do_NOTICE" .IX Subsection "do_NOTICE" .Vb 1 \& $irc\->do_PRIVMSG( target => $target, text => $text )\->get \& \& $irc\->do_NOTICE( target => $target, text => $text )\->get .Ve .PP Sends a \f(CW\*(C`PRIVMSG\*(C'\fR or \f(CW\*(C`NOITICE\*(C'\fR command. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "\(bu" 4 \- Internet Relay Chat: Client Protocol .SH "AUTHOR" .IX Header "AUTHOR" Paul Evans