Jon Portnoy > IRC-Toolkit-0.084002 > IRC::Message::Object

Download:
IRC-Toolkit-0.084002.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.084002   Source   Latest Release: IRC-Toolkit-0.088002

NAME ^

IRC::Message::Object - Incoming or outgoing IRC events

SYNOPSIS ^

  ## Feed me some parameters:
  my $event = IRC::Message::Object->new(
    command  => '001',
    prefix   => ':some.server.org',
    params   => [ 'user', 'Welcome to IRC' ],
  );

  ## ... or import and use the 'ircmsg()' shortcut:
  use IRC::Message::Object 'ircmsg';
  my $event = ircmsg(
    command => '001',
    prefix  => ':some.server.org',
    params  => [ 'user', 'Welcome to IRC' ],
  );

  ## ... or take a raw IRC line (and parse it):
  $event = ircmsg(
    raw_line => ':some.server.org 001 user :Welcome to IRC'
  );

  ## ... or feed from POE::Filter::IRCD or POE::Filter::IRCv3:
  $event = ircmsg( %$ref_from_filter );

  ## ... retrieve useful bits later (see Methods):
  my $cmd  = $event->command;
  my $line = $event->raw_line;
  if ($event->has_tag('monkeys')) {
    ...
  }

DESCRIPTION ^

These objects represent incoming or outgoing IRC messages (events); they can be created from either named parameters or a raw IRC line and provide accessors with automatic parsing magic.

Functions

ircmsg

Create a new IRC::Message::Object

Shortcut for IRC::Message::Object->new

Attributes and Methods

raw_line

The raw IRC line. The line is generated via the current "filter" if the message object wasn't constructed with one.

predicate: has_raw_line

command

The parsed command received.

Note that if the command is set at construction time, no case-folding takes place. However, specifying a raw_line at construction feeds POE::Filter::IRCv3, which will uppercase commands.

predicate: has_command

params

ARRAY of parameters.

predicate: has_command

prefix

The origin prefix.

predicate: has_prefix

colonify

Set to a boolean false value at construction time to instruct POE::Filter::IRCv3 not to always prefix the last argument with a colon.

Defaults to true.

filter

Can be used to change the POE::Filter used to transform a raw line into a HASH and vice-versa.

Defaults to a POE::Filter::IRCv3 instance.

get_tag

Retrieve a specific IRCv3.2 message tag's value.

This only works for tags with a defined value; see "has_tag" to discover if a tag exists.

has_tag

Takes a tag identifier; returns true if the tag exists.

This is useful for finding out about tags that have no defined value.

has_tags

Returns true if there are tags present.

tags

IRCv3.2 message tags, as a HASH of key-value pairs.

tags_as_array

IRCv3.2 message tags, as an ARRAY of tags in the form of 'key=value'

tags_as_string

IRCv3.2 message tags as a specification-compliant string.

truncate

Truncates the raw line to 510 characters, excluding message tags (per the specification), and returns a new IRC::Message::Object.

AUTHOR ^

Jon Portnoy <avenj@cobaltirc.org>

syntax highlighting: