NAME

POE::Component:IRC::Common - provides a set of common functions for the POE::Component::IRC suite.

SYNOPSIS

use strict;
use warnings;

use POE::Component::IRC::Common qw( :ALL );

my $nickname = '^Lame|BOT[moo]';

my $uppercase_nick = u_irc( $nickname );
my $lowercase_nick = l_irc( $nickname );

my $mode_line = 'ov+b-i Bob sue stalin*!*@*';
my $hashref = parse_mode_line( $mode_line );

my $banmask = 'stalin*';
$full_banmask = parse_ban_mask( $banmask );

DESCRIPTION

POE::Component:IRC::Common provides a set of common functions for the POE::Component::IRC suite. There are included functions for uppercase and lowercase nicknames/channelnames and for parsing mode lines and ban masks.

FUNCTIONS

u_irc

Takes one parameter, a string to convert to IRC uppercase. Returns the IRC uppercase equivalent of the passed string.

l_irc

Takes one parameter, a string to convert to IRC lowercase. Returns the IRC lowercase equivalent of the passed string.

parse_mode_line

Takes a list representing an IRC mode line. Returns a hashref. If the modeline couldn't be parsed the hashref will be empty. On success the following keys will be available in the hashref:

'modes', an arrayref of normalised modes;
'args', an arrayref of applicable arguments to the modes;

Example:

   my $hashref = parse_mode_line( 'ov+b-i', 'Bob', 'sue', 'stalin*!*@*' );

   $hashref will be 
   {
	'modes' => [ '+o', '+v', '+b', '-i' ],
	'args'  => [ 'Bob', 'sue', 'stalin*!*@*' ],
   };
parse_ban_mask

Takes one parameter, a string representing an IRC ban mask. Returns a normalised full banmask.

Example:

$fullbanmask = parse_ban_mask( 'stalin*' );

$fullbanmask will be 'stalin*!*@*';

AUTHOR

Chris 'BinGOs' Williams

SEE ALSO

POE::Component::IRC