The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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):
  my $event = ircmsg(
    raw_line => ':some.server.org 001 user :Welcome to IRC'
  );

  ## ... or feed from POE::Filter::IRCD or POE::Filter::IRCv3:
  my $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

Methods

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

raw_line

The raw IRC line. This will be generated via POE::Filter::IRCv3 if we weren't constructed with one.

predicate: has_raw_line

get_tag

Retrieve a specific tag.

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.

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.

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>