Jon Portnoy > IRC-Toolkit > IRC::Toolkit::Role::CaseMap

Download:
IRC-Toolkit-0.088002.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.088002   Source  

NAME ^

IRC::Toolkit::Role::CaseMap - Role for classes that track IRC casemapping

SYNOPSIS ^

  package MyIRC;
  use Moo;

  has casemap => (
    is  => 'rw',
    default => sub { 'rfc1459' },
    coerce  => sub { lc $_[0] },
  );

  with 'IRC::Toolkit::Role::CaseMap';

  sub mymeth {
    my ($self, $nickname, $one, $two) = @_;

    my $lowered = $self->lower( $nickname );
    my $uppered = $self->upper( $nickname );

    if ( $self->equal( $one, $two ) ) {
      ...
    }
  }

DESCRIPTION ^

A Role::Tiny role that provides convenient helper methods for classes that track IRC casemapping, such as IRC client libraries.

This role requires a casemap attribute that returns one of 'rfc1459', 'ascii', or 'strict-rfc1459' -- see IRC::Toolkit::Case for details on IRC casemap issues.

lower

Returns the IRC-lowercased string.

upper

Returns the IRC-uppercased string.

equal

Expects two strings; returns true if they are equal per the current casemap rules. Returns empty list if the strings do not match.

AUTHOR ^

Jon Portnoy <avenj@cobaltirc.org>

syntax highlighting: