| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Acme::LeetSpeak; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
36927
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
38
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
38
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use base 'Exporter'; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
3167
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT = qw/leet/; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Acme::LeetSpeak - Speak like a kI[)dI3 |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 0.01 |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This module makes translates english sentences into "leet". For more |
|
24
|
|
|
|
|
|
|
information on leet, please consult wikipedia (L< http://en.wikipedia.org/ >). |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use warnings; |
|
27
|
|
|
|
|
|
|
use strict; |
|
28
|
|
|
|
|
|
|
use Acme::LeetSpeak; |
|
29
|
|
|
|
|
|
|
... |
|
30
|
|
|
|
|
|
|
my $leet = leet( $string ); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 leet |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use constant { |
|
39
|
1
|
|
|
|
|
1014
|
INPUT => 0, |
|
40
|
|
|
|
|
|
|
CHANCE => 1, |
|
41
|
|
|
|
|
|
|
OUTPUTS => 2, |
|
42
|
1
|
|
|
1
|
|
16
|
}; |
|
|
1
|
|
|
|
|
3
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
our @LEET_WORD_MAP = ( |
|
45
|
|
|
|
|
|
|
# pre number-ization |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# words |
|
48
|
|
|
|
|
|
|
[ '\bfear\b', 10, [ 'phear', ], ], |
|
49
|
|
|
|
|
|
|
[ '\bp(?:ro|or)n\w*\b', 10, [ 'pron', ] ], |
|
50
|
|
|
|
|
|
|
[ '\belite\b', 10, [ 'eleet', 'leet', ], ], |
|
51
|
|
|
|
|
|
|
[ '\bdo\b', 9, [ 'do', 'doo', ], ], |
|
52
|
|
|
|
|
|
|
[ '\bthe\b', 9, [ 'teh', 'da', ], ], |
|
53
|
|
|
|
|
|
|
[ '\byou\b', 9, [ 'yuo', 'joo', ], ], |
|
54
|
|
|
|
|
|
|
[ '\byour\b', 9, [ 'yuor', 'joor', ], ], |
|
55
|
|
|
|
|
|
|
[ '\bdude\b', 9, [ '${1}od', '${1}ood', ], ], |
|
56
|
|
|
|
|
|
|
[ '\bhack\b', 9, [ 'hax', ], ], |
|
57
|
|
|
|
|
|
|
[ '\b(?:too?|two)\b', 9, [ '2', ], ], |
|
58
|
|
|
|
|
|
|
[ '\b(?:good)?bye\b', 9, [ 'latez', 'laterz', 'cya', 'bai', ], ], |
|
59
|
|
|
|
|
|
|
[ '\b(?:hi|hello)\b', 9, [ 'hai', 'y helo thar', 'hai2u', ], ], |
|
60
|
|
|
|
|
|
|
[ '\bat\b', 9, [ '\\@', ], ], |
|
61
|
|
|
|
|
|
|
[ '\bdude(\w*)\b', 9, [ 'dood${1}', ], ], |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# suffixes |
|
65
|
|
|
|
|
|
|
[ '\b(\w+)er\b', 7, [ '${1}xor', '${1}xxor', '${1}zor', '${1}or', ], ], |
|
66
|
|
|
|
|
|
|
[ '\b(\w+)ed\b', 7, [ '${1}\'d', '${1}d', '${1}t', ], ], |
|
67
|
|
|
|
|
|
|
[ '\b(\w+)cks\b', 7, [ '${1}x', '${1}xx', ], ], |
|
68
|
|
|
|
|
|
|
[ '\b(\w+)an(?:d|n?ned|nt)\b', 7, [ '${1}&', ] ], |
|
69
|
|
|
|
|
|
|
); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
our %LEET_CHAR_MAP = ( |
|
72
|
|
|
|
|
|
|
# letters |
|
73
|
|
|
|
|
|
|
'a', [ '4', '/-\\', '@', ], |
|
74
|
|
|
|
|
|
|
'b', [ '8', '|3', '(3', ], |
|
75
|
|
|
|
|
|
|
'c', [ '[', '<', '(', '{', ], |
|
76
|
|
|
|
|
|
|
'd', [ ')', '[)', '|)', ], |
|
77
|
|
|
|
|
|
|
'e', [ '3', ], |
|
78
|
|
|
|
|
|
|
'f', [ '|=', '|#', ], |
|
79
|
|
|
|
|
|
|
'g', [ '9', ], |
|
80
|
|
|
|
|
|
|
'h', [ '#', '/-/', '[-]', ']-[', ')-(', '}{', '|-|' ], |
|
81
|
|
|
|
|
|
|
'i', [ '1', '!', '|', '][', ], |
|
82
|
|
|
|
|
|
|
'j', [ '_|', '_/', ], |
|
83
|
|
|
|
|
|
|
'k', [ '|<', ], |
|
84
|
|
|
|
|
|
|
'l', [ '1', '7', '1_', '|', '|_', ], |
|
85
|
|
|
|
|
|
|
'm', [ '|\\/|', '/\\/\\', '/|/|', ], |
|
86
|
|
|
|
|
|
|
'n', [ '|\\|', '/\\/', '[\\]', ], |
|
87
|
|
|
|
|
|
|
'o', [ '()', 'oh', '0', ], |
|
88
|
|
|
|
|
|
|
'p', [ '|o', '|*', '|>', ], |
|
89
|
|
|
|
|
|
|
'q', [ '0_', '(,)', ], |
|
90
|
|
|
|
|
|
|
'r', [ 'r' ], |
|
91
|
|
|
|
|
|
|
's', [ '5', '$', ], |
|
92
|
|
|
|
|
|
|
't', [ '7', '+', ], |
|
93
|
|
|
|
|
|
|
'u', [ '(_)', '|_|', ], |
|
94
|
|
|
|
|
|
|
'v', [ '\\/', '\\|', '|/', ], |
|
95
|
|
|
|
|
|
|
'w', [ '\\/\\/', '\\^/', '\v/', ], |
|
96
|
|
|
|
|
|
|
'x', [ '><', '}{', ], |
|
97
|
|
|
|
|
|
|
'y', [ 'j', '¥', '`/', ], |
|
98
|
|
|
|
|
|
|
'z', [ 'z' ], |
|
99
|
|
|
|
|
|
|
); |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
our $CHANCE_OF_LEET_CHAR = 5; # out of 10 |
|
102
|
|
|
|
|
|
|
our $CHANCE_OF_UPPER_CHAR = 5; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub leet { |
|
105
|
0
|
|
|
0
|
1
|
|
my $text = shift; |
|
106
|
0
|
0
|
0
|
|
|
|
return unless defined $text and $text ne '' and $text !~ /^\s+$/; |
|
|
|
|
0
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
foreach my $rule ( @LEET_WORD_MAP ) { |
|
108
|
0
|
0
|
0
|
|
|
|
if ( $text =~ $rule->[INPUT] && int( rand 9 ) < $rule->[CHANCE] ) { |
|
109
|
0
|
|
|
|
|
|
my $find = $rule->[INPUT]; |
|
110
|
0
|
|
|
|
|
|
my $switch = $rule->[OUTPUTS]->[ rand @{ $rule->[OUTPUTS] } ]; |
|
|
0
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
$text =~ s/$find/$switch/i; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
} |
|
114
|
0
|
|
|
|
|
|
$text =~ s/([a-z])/_leetchar($1)/ige; |
|
|
0
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
return $text; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub _leetchar { |
|
119
|
0
|
|
|
0
|
|
|
my $char = shift; |
|
120
|
0
|
0
|
|
|
|
|
if ( int( rand 9 ) < $CHANCE_OF_LEET_CHAR ) { |
|
121
|
0
|
|
|
|
|
|
my $leet = $LEET_CHAR_MAP{lc $char}; |
|
122
|
0
|
|
|
|
|
|
$char = $leet->[ rand @{ $leet } ]; |
|
|
0
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
} |
|
124
|
0
|
0
|
|
|
|
|
if ( int( rand 9 ) < $CHANCE_OF_UPPER_CHAR ) { |
|
125
|
0
|
|
|
|
|
|
$char = uc $char; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
0
|
|
|
|
|
|
return $char; |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 AUTHOR |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Jordan M. Adler, C<< >> |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 BUGS |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
|
137
|
|
|
|
|
|
|
C, or through the web interface at |
|
138
|
|
|
|
|
|
|
L. |
|
139
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
|
140
|
|
|
|
|
|
|
your bug as I make changes. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 SUPPORT |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
perldoc Acme::LeetSpeak |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
You can also look for information at: |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=over 4 |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
L |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
L |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
L |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item * Search CPAN |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
L |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=back |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Copyright 2007 Jordan M. Adler, all rights reserved. |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
177
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=cut |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
1; # End of Acme::LeetSpeak |