package N0i::Xchat::GoogleMoron; use strict; use warnings; use base qw(N0i::Xchat::Base); use URI::Escape (); sub version { '2005122001' } sub new { my ($class, %o) = @_; my $self = { %o }; $self->{baseurl} ||= 'http://www.googleityoumoron.com/?go='; bless $self, $class; } sub moron { my ($self, $text) = @_; return (undef, 'no text?!') unless defined $text && $text =~ /\S/; # extract nickname my $ret = ''; $text =~ s/^(\S+)\s*// and $ret .= "$1: "; return (undef, 'nickname, but still... no text?!') unless defined $text && $text =~ /\S/; $ret .= $self->{baseurl} . URI::Escape::uri_escape($text); return ($ret, undef); } 1;