IRC::Toolkit::CTCP - CTCP parsing utilities
## Extract first CTCP request/reply from a message: if (my $ctcp_ev = ctcp_extract( $orig_msg ) ) { ## CTCP was found; $ctcp_ev is an IRC::Message::Object ... } ## Properly CTCP-quote a string: my $quoted_ctcp = ctcp_quote("PING 1234"); ## Deparse CTCP messages (including multipart): if (my $ref = ctcp_unquote($raw_line)) { my @ctcp = @{ $ref->{ctcp} }; my @txt = @{ $ref->{text} }; ... }
Utility functions useful for quoting/unquoting/extracting CTCP.
Takes input (in the form of an IRC::Message::Object instance, a hash such as that produced by POE::Filter::IRCv3, or a raw line) and attempts to extract a valid CTCP request or reply.
Returns an IRC::Message::Object whose command carries an appropriate prefix (one of ctcp, ctcpreply, or dcc_request) prepended to the CTCP command:
command
## '$ev' is your incoming or outgoing IRC::Message::Object ## CTCP VERSION request: $ev->command eq 'ctcp_version' ## Reply to CTCP VERSION: $ev->command eq 'ctcpreply_version' ## DCC SEND: $ev->command eq 'dcc_request_send'
Returns empty list if no valid CTCP was found.
CTCP quote a raw line.
Deparses a raw line possibly containing CTCP.
Returns a hash with two keys, ctcp and text, whose values are ARRAYs containing the CTCP and text portions of a CTCP-quoted message.
Returns an empty list if no valid CTCP was found.
Jon Portnoy <avenj@cobaltirc.org>
Code derived from Net::IRC and POE::Filter::IRC::Compat, copyright BinGOs, HINRIK, fimm, Abigail et al
Licensed under the same terms as POE::Filter::IRC::Compat and Perl itself.
To install IRC::Toolkit, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IRC::Toolkit
CPAN shell
perl -MCPAN -e shell install IRC::Toolkit
For more information on module installation, please visit the detailed CPAN module installation guide.