blib/lib/Lingua/31337.pm

filter: Statementstmt 43.3% 13 / 30 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 2 / 3 Podpod 100% 1 / 1 totaltotal 34.7% 16 / 46 CC 9 SCAR 43.0
CC
9
Cov
31%
text231337
90.0
BEGIN
1.0
BEGIN
1.0
CRAP 73.8
↑ Summary
1 package Lingua::31337;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use vars qw[%EXPORT_TAGS @EXPORT $VERSION %CONVERSIONS $LEVEL];
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 %EXPORT_TAGS = ( 'all' => [ qw[ text231337 ] ] );
8  
9 1 @EXPORT = ( @{ $EXPORT_TAGS{'all'} } );
10  
11 1 $VERSION = '0.02';
12  
13 1 $LEVEL = 5;
14  
15 1 %CONVERSIONS = (
16  
17 # handle the vowels
18 1 => {
19 mixcase => 0,
20 chars => {
21 a => 4,
22 e => 3,
23 i => 1,
24 o => 0,
25 },
26 },
27  
28 # Handle vowels and some consonants,
29 # don't use punctuation in the translation,
30 # shift case at random.
31 5 => {
32 mixcase => 1,
33 chars => {
34 a => 4,
35 e => 3,
36 f => 'ph',
37 i => 1,
38 l => 1,
39 o => 0,
40 's$' => 'z',
41 t => 7,
42 },
43 },
44  
45 # Handle vowels and most consonants,
46 # use punctuation in the translation,
47 # shift case at random,
48 # convert some letters.
49 7 => {
50 mixcase => 1,
51 chars => {
52 a => 4,
53 b => '|3',
54 d => '|)',
55 e => 3,
56 f => 'ph',
57 h => '|-|',
58 i => 1,
59 k => '|<',
60 l => 1,
61 'm' => '|\/|',
62 n => '|\|',
63 o => 0,
64 's$' => 'z',
65 t => '-|-',
66 v => '\/',
67 w => '\/\/',
68 x => '><',
69 },
70 },
71  
72 # Handle vowels and most consonants,
73 # use punctuation in the translation,
74 # shift case at random,
75 # convert some letters to others,
76 # decide between several options.
77 9 => {
78 mixcase => 1,
79 chars => {
80 a => [ 4, 'aw' ],
81 b => '|3',
82 ck => 'x',
83 'ck$' => 'x0rz',
84 d => '|)',
85 e => [ 3, 0, 'o' ],
86 'ed$' => 'z0r3d',
87 'er$' => '0r',
88 f => 'ph',
89 h => '|-|',
90 i => 1,
91 k => '|<',
92 l => 1,
93 'm' => '|\/|',
94 n => '|\|',
95 o => 0,
96 's' => 'z',
97 t => '-|-',
98 v => '\/',
99 w => '\/\/',
100 x => '><',
101 },
102 },
103 );
104  
105 0 ▶sub text231337 {
Subroutine text231337: not called CC=9 SCAR=45.0
Pod documented
106 0 my @text = @_;
107 0 my @new_text = ();
108
109 0 ▶ $LEVEL-- until exists $CONVERSIONS{$LEVEL};
Branch: 1 branch
BranchTrueFalseTotal
exists $Lingua::31337::CONVERSIONS{$Lingua::31337::LEVEL} or do { --$Lingua::31337::LEVEL } 0 0 0
110
111 0 foreach my $line ( @text ) {
112 0 foreach ( keys %{$CONVERSIONS{$LEVEL}->{chars}} ) {
113 0 ▶ if ( ref $CONVERSIONS{$LEVEL}->{chars}->{$_} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $Lingua::31337::CONVERSIONS{$Lingua::31337::LEVEL}{'chars'}{$_}) { } 0 0 0
114 0 ▶ $line =~ s/($_)/(0,1)[rand 2] ? @{$CONVERSIONS{$LEVEL}->{chars}{$_}}[rand $#{$CONVERSIONS{$LEVEL}->{chars}{$_}}] : $1/egi;
Branch: 1 branch
BranchTrueFalseTotal
(0, 1)[rand 2] ? : 0 0 0
115 } else {
116 0 ▶ $line =~ s/($_)/(0,1)[rand 2] ? $CONVERSIONS{$LEVEL}->{chars}{$_} : $1/egi;
Branch: 1 branch
BranchTrueFalseTotal
(0, 1)[rand 2] ? : 0 0 0
117 }
118 }
119 0 ▶ $line =~ s/([A-Z])/(0,1)[rand 2] ? uc($1) : lc($1)/egi if $CONVERSIONS{$LEVEL}->{mixcase};
Branch: 2 branches
BranchTrueFalseTotal
if $Lingua::31337::CONVERSIONS{$Lingua::31337::LEVEL}{"mixcase"} 0 0 0
(0, 1)[rand 2] ? : 0 0 0
120 0 push @new_text, $line;
121 }
122 0 return @new_text;
123 }
124  
125  
126 1 1;
127 __END__
↑ Summary