Add documentation
[text-homestuck.git] / lib / Text / Homestuck.pm
CommitLineData
4d0a1f46
MG
1package Text::Homestuck;
2
3use 5.014000;
4use strict;
5use warnings;
6b060d8e
MG
6use parent qw/Exporter/;
7our @EXPORT = qw/aradia tavros sollux karkat nepeta kanaya terezi vriska equius gamzee eridan feferi/;
4d0a1f46 8our $VERSION = '0.000_001';
4d0a1f46 9
260a36fc
MG
10sub filter {
11 my ($name, $code) = @_;
12 no strict 'refs';
13 *{$name} = sub (;$){
14 local *__ANON__ = $name;
15 if ($_[0]) {
16 local $_ = $_[0];
17 $code->();
18 $_
19 } else {
20 $code->();
21 $_
22 }
23 }
24}
4d0a1f46 25
260a36fc 26filter aradia => sub {
6b060d8e
MG
27 y/A-Z/a-z/;
28 y/,.?//d;
29 s/o/0/g;
260a36fc 30};
6b060d8e 31
260a36fc 32filter tavros => sub {
6b060d8e
MG
33 y/a-zA-Z.!?/A-Za-z,,,/;
34 s/:\)/}:)/g;
260a36fc 35};
6b060d8e 36
260a36fc 37filter sollux => sub {
6b060d8e
MG
38 y/A-Z/a-z/;
39 y/s/2/;
40 s/i/ii/g;
41 s/to/two/g;
42 s/\b(fuck|joke|kk|aa)\b/\U$1/g;
260a36fc 43};
6b060d8e 44
260a36fc 45filter karkat => sub {
6b060d8e
MG
46 y/a-z/A-Z/;
47 s/\bD:/D:B/;
260a36fc 48};
6b060d8e 49
260a36fc 50filter nepeta => sub {
6b060d8e
MG
51 y/A-Z/a-z/;
52 s/ee/33/;
53 $_ = ":33 < $_";
260a36fc 54};
6b060d8e 55
260a36fc 56filter kanaya => sub {
6b060d8e
MG
57 y/,.!?'//d;
58 s/\b(\w)/\u$1/g;
260a36fc 59};
6b060d8e 60
260a36fc 61filter terezi => sub {
6b060d8e
MG
62 y/a-z/A-Z/;
63 y/AIE/413/;
64 s/(!|\?)/$1$1/g;
65 s/:\]|:\)/>:]/g;
260a36fc 66};
6b060d8e 67
260a36fc 68filter vriska => sub {
6b060d8e
MG
69 y/Bb/88/;
70 s/:\)/::::\)/g;
71 s/D:/D::::/g;
260a36fc 72};
6b060d8e 73
260a36fc 74filter equius => sub {
6b060d8e
MG
75 s/strong/STRONG/g;
76 s/strength/STRONGNESS/g;
77 s/x/%/ig;
78 s/loo/100/ig;
79 s/ool/001/ig;
80 s/[?.!]$//;
81 $_ = "D --> $_";
260a36fc 82};
6b060d8e 83
260a36fc 84filter gamzee => sub {
6b060d8e
MG
85 y/[A-Z]/[a-z]/;
86 s/([a-z])(.)/$1\u$2/g;
87 s/:\)/:o\)/g;
260a36fc 88};
6b060d8e 89
260a36fc 90filter eridan => sub {
6b060d8e
MG
91 y/',.?!//d;
92 s/w/ww/g;
93 s/v/vv/g;
94 s/ing/in/g;
95 s/want to/wanna/g;
96 s/going to/gonna/g;
260a36fc 97};
6b060d8e 98
260a36fc 99filter feferi => sub {
6b060d8e
MG
100 s/H/)(/g;
101 s/E/-E/g;
102 s/:\)/38)/g;
260a36fc 103};
4d0a1f46
MG
104
1051;
106__END__
4d0a1f46
MG
107
108=head1 NAME
109
f9228a00 110Text::Homestuck - Emulate the typing quirks of Homestuck trolls
4d0a1f46
MG
111
112=head1 SYNOPSIS
113
114 use Text::Homestuck;
f9228a00
MG
115 say feferi 'HELLO WORLD!'; # )(-ELLO WORLD!
116 my @array = ('Move along.', 'Nothing to see here');
117 aradia for @array;
118 say "@array"; # m0ve al0ng n0thing t0 see here
4d0a1f46
MG
119
120=head1 DESCRIPTION
121
f9228a00 122Text::Homestuck exports several subroutines, one for each typing quirk. There are 12 such functions right now, one for each pre-scratch troll: aradia, tavros, sollux, karkat, nepeta, kanaya, terezi, vriska, equius, gamzee, eridan, feferi.
4d0a1f46 123
f9228a00 124Each subroutine takes one or no arguments. If called with an argument, they apply the quirk to the argument and return the result. If called with no arguments, they apply the quirk to C<$_>, modifiying it in-place, and returning C<$_>.
4d0a1f46
MG
125
126=head1 SEE ALSO
127
6b060d8e 128Homestuck: L<http://mspaintadventures.com/?s=6&p=001901>
f9228a00
MG
129
130A table of typing quirks: L<http://mspaintadventures.wikia.com/wiki/Typing_Quirk>
4d0a1f46
MG
131
132=head1 AUTHOR
133
f9228a00 134Marius Gavrilescu C<< <marius@ieval.ro> >>
4d0a1f46
MG
135
136=head1 COPYRIGHT AND LICENSE
137
138Copyright (C) 2014 by Marius Gavrilescu
139
140This library is free software; you can redistribute it and/or modify
141it under the same terms as Perl itself, either Perl version 5.18.2 or,
142at your option, any later version of Perl 5 you may have available.
143
144
145=cut
This page took 0.021503 seconds and 4 git commands to generate.