package Text::Homestuck;

use 5.014000;
use strict;
use warnings;
use parent qw/Exporter/;
our @EXPORT = qw/aradia tavros sollux karkat nepeta kanaya terezi vriska equius gamzee eridan feferi/;
our $VERSION = '0.000_001';

sub filter {
	my ($name, $code) = @_;
	no strict 'refs';
	*{$name} = sub (;$){
		local *__ANON__ = $name;
		if ($_[0]) {
			local $_ = $_[0];
			$code->();
			$_
		} else {
			$code->();
			$_
		}
	}
}

filter aradia => sub {
	y/A-Z/a-z/;
	y/,.?//d;
	s/o/0/g;
};

filter tavros => sub {
	y/a-zA-Z.!?/A-Za-z,,,/;
	s/:\)/}:)/g;
};

filter sollux => sub {
	y/A-Z/a-z/;
	y/s/2/;
	s/i/ii/g;
	s/to/two/g;
	s/\b(fuck|joke|kk|aa)\b/\U$1/g;
};

filter karkat => sub {
	y/a-z/A-Z/;
	s/\bD:/D:B/;
};

filter nepeta => sub {
	y/A-Z/a-z/;
	s/ee/33/;
	$_ = ":33 < $_";
};

filter kanaya => sub {
	y/,.!?'//d;
	s/\b(\w)/\u$1/g;
};

filter terezi => sub {
	y/a-z/A-Z/;
	y/AIE/413/;
	s/(!|\?)/$1$1/g;
	s/:\]|:\)/>:]/g;
};

filter vriska => sub {
	y/Bb/88/;
	s/:\)/::::\)/g;
	s/D:/D::::/g;
};

filter equius => sub {
	s/strong/STRONG/g;
	s/strength/STRONGNESS/g;
	s/x/%/ig;
	s/loo/100/ig;
	s/ool/001/ig;
	s/[?.!]$//;
	$_ = "D --> $_";
};

filter gamzee => sub {
	y/[A-Z]/[a-z]/;
	s/([a-z])(.)/$1\u$2/g;
	s/:\)/:o\)/g;
};

filter eridan => sub {
	y/',.?!//d;
	s/w/ww/g;
	s/v/vv/g;
	s/ing/in/g;
	s/want to/wanna/g;
	s/going to/gonna/g;
};

filter feferi => sub {
	s/H/)(/g;
	s/E/-E/g;
	s/:\)/38)/g;
};

1;
__END__
# Below is stub documentation for your module. You'd better edit it!

=head1 NAME

Text::Homestuck - Perl extension for blah blah blah

=head1 SYNOPSIS

  use Text::Homestuck;
  blah blah blah

=head1 DESCRIPTION

Stub documentation for Text::Homestuck, created by h2xs. It looks like the
author of the extension was negligent enough to leave the stub
unedited.

Blah blah blah.

=head2 EXPORT

None by default.



=head1 SEE ALSO

Homestuck: L<http://mspaintadventures.com/?s=6&p=001901>
The mspa wiki page listing the quirks: http://mspaintadventures.wikia.com/wiki/Typing_Quirk

=head1 AUTHOR

Marius Gavrilescu, E<lt>marius@E<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2014 by Marius Gavrilescu

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.18.2 or,
at your option, any later version of Perl 5 you may have available.


=cut
