line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Text::Viceversa; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
552
|
use 5.008001; |
|
1
|
|
|
|
|
3
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
16
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
6
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
44
|
|
7
|
1
|
|
|
1
|
|
4
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = "0.07"; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
1
|
|
|
1
|
0
|
485
|
my $class = shift; |
13
|
1
|
|
|
|
|
2
|
return bless {}, $class; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my %ascii = ( |
17
|
|
|
|
|
|
|
q' ' => ' ', # same! |
18
|
|
|
|
|
|
|
q'!' => '¡', |
19
|
|
|
|
|
|
|
q'"' => '„', |
20
|
|
|
|
|
|
|
q'#' => '#', # same! |
21
|
|
|
|
|
|
|
q'$' => '$', # same! |
22
|
|
|
|
|
|
|
q'%' => '%', # same! |
23
|
|
|
|
|
|
|
q'&' => '⅋', |
24
|
|
|
|
|
|
|
q|'| => '͵', |
25
|
|
|
|
|
|
|
q|(| => ')', |
26
|
|
|
|
|
|
|
q|)| => '(', |
27
|
|
|
|
|
|
|
q|*| => '*', # same! |
28
|
|
|
|
|
|
|
q|+| => '+', # same! |
29
|
|
|
|
|
|
|
q|,| => '‘', |
30
|
|
|
|
|
|
|
q|-| => '-', # same! |
31
|
|
|
|
|
|
|
q|.| => '˙', |
32
|
|
|
|
|
|
|
q|/| => '/', # same! |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
q|0| => '0', # same! |
35
|
|
|
|
|
|
|
q|1| => '⇂', |
36
|
|
|
|
|
|
|
q|2| => 'ᘔ', |
37
|
|
|
|
|
|
|
q|3| => 'ε', |
38
|
|
|
|
|
|
|
q|4| => '⇁⃓', |
39
|
|
|
|
|
|
|
q|5| => 'ᔕ', |
40
|
|
|
|
|
|
|
q|6| => '9', |
41
|
|
|
|
|
|
|
q|7| => 'L', |
42
|
|
|
|
|
|
|
q|8| => '8', # same! |
43
|
|
|
|
|
|
|
q|9| => '6', |
44
|
|
|
|
|
|
|
q|:| => ':', # same! |
45
|
|
|
|
|
|
|
q|;| => '⋅̕', |
46
|
|
|
|
|
|
|
q|<| => '>', |
47
|
|
|
|
|
|
|
q|=| => '=', # same! |
48
|
|
|
|
|
|
|
q|>| => '<', |
49
|
|
|
|
|
|
|
q|?| => '¿', |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
q|@| => '@', # Can't be rotate |
52
|
|
|
|
|
|
|
q|A| => '∀', |
53
|
|
|
|
|
|
|
q|B| => 'ᗺ', |
54
|
|
|
|
|
|
|
q|C| => 'Ↄ', |
55
|
|
|
|
|
|
|
q|D| => 'p', |
56
|
|
|
|
|
|
|
q|E| => 'Ǝ', |
57
|
|
|
|
|
|
|
q|F| => 'Ⅎ', |
58
|
|
|
|
|
|
|
q|G| => '⅁', |
59
|
|
|
|
|
|
|
q|H| => 'H', # same! |
60
|
|
|
|
|
|
|
q|I| => 'I', # same! |
61
|
|
|
|
|
|
|
q|J| => 'ᒋ', |
62
|
|
|
|
|
|
|
q|K| => '丬', |
63
|
|
|
|
|
|
|
q|L| => 'ᒣ', |
64
|
|
|
|
|
|
|
q|M| => 'W', |
65
|
|
|
|
|
|
|
q|N| => 'N', # same! |
66
|
|
|
|
|
|
|
q|O| => 'O', # same! |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
q|P| => 'Ԁ', |
69
|
|
|
|
|
|
|
q|Q| => 'Ό', |
70
|
|
|
|
|
|
|
q|R| => 'Ȣ', |
71
|
|
|
|
|
|
|
q|S| => 'S', # same! |
72
|
|
|
|
|
|
|
q|T| => '⊥', |
73
|
|
|
|
|
|
|
q|U| => 'ᑎ', |
74
|
|
|
|
|
|
|
q|V| => 'Λ', |
75
|
|
|
|
|
|
|
q|W| => 'M', |
76
|
|
|
|
|
|
|
q|X| => 'X', # same! |
77
|
|
|
|
|
|
|
q|Y| => '⅄', |
78
|
|
|
|
|
|
|
q|Z| => 'Z', # same! |
79
|
|
|
|
|
|
|
q|]| => '[', |
80
|
|
|
|
|
|
|
q|\\| => '\\', # same! |
81
|
|
|
|
|
|
|
q|[| => ']', |
82
|
|
|
|
|
|
|
q|^| => '‿', |
83
|
|
|
|
|
|
|
q|_| => '‾', |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
q|`| => ' ̖', #` # ɓuᴉʇɥɓᴉꞁɥɓᴉɥ xɐʇuʎs pᴉoʌɐ oʇ |
86
|
|
|
|
|
|
|
q|a| => 'ɐ', |
87
|
|
|
|
|
|
|
q|b| => 'q', |
88
|
|
|
|
|
|
|
q|c| => 'ɔ', |
89
|
|
|
|
|
|
|
q|d| => 'p', |
90
|
|
|
|
|
|
|
q|e| => 'ǝ', |
91
|
|
|
|
|
|
|
q|f| => 'ɟ', |
92
|
|
|
|
|
|
|
q|g| => 'ɓ', |
93
|
|
|
|
|
|
|
q|h| => 'ɥ', |
94
|
|
|
|
|
|
|
q|i| => 'ᴉ', |
95
|
|
|
|
|
|
|
q|j| => 'ſ̣', |
96
|
|
|
|
|
|
|
q|k| => 'ʞ', |
97
|
|
|
|
|
|
|
q|l| => 'ꞁ', |
98
|
|
|
|
|
|
|
q|m| => 'ɯ', |
99
|
|
|
|
|
|
|
q|n| => 'u', |
100
|
|
|
|
|
|
|
q|o| => 'o', # same! |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
q|p| => 'd', |
103
|
|
|
|
|
|
|
q|q| => 'b', |
104
|
|
|
|
|
|
|
q|r| => 'ɹ', |
105
|
|
|
|
|
|
|
q|s| => 's', # same! |
106
|
|
|
|
|
|
|
q|t| => 'ʇ', |
107
|
|
|
|
|
|
|
q|u| => 'n', |
108
|
|
|
|
|
|
|
q|v| => 'ʌ', |
109
|
|
|
|
|
|
|
q|w| => 'ʍ', |
110
|
|
|
|
|
|
|
q|x| => 'x', # same! |
111
|
|
|
|
|
|
|
q|y| => 'ʎ', |
112
|
|
|
|
|
|
|
q|z| => 'z', # same! |
113
|
|
|
|
|
|
|
q|{| => '}', |
114
|
|
|
|
|
|
|
q{|} => '|', # same! |
115
|
|
|
|
|
|
|
q|}| => '{', |
116
|
|
|
|
|
|
|
q|~| => '∼', # same! |
117
|
|
|
|
|
|
|
); |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
my %rot180 = %ascii; |
120
|
|
|
|
|
|
|
my $list = ''; |
121
|
|
|
|
|
|
|
while( my( $from, $to ) = each %ascii ){ # to make reversed list |
122
|
|
|
|
|
|
|
next if $to =~ /^[ -~]$/; # skip if it was an ascii |
123
|
|
|
|
|
|
|
$rot180{$to} = $from; # add reversed key |
124
|
|
|
|
|
|
|
$list .= $to; # add the charactors to the list |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
$list = "\Q" . $list; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub ɐsɹǝʌǝɔᴉʌ { |
129
|
6
|
|
|
6
|
0
|
1003447
|
my $self = shift; |
130
|
6
|
|
|
|
|
8
|
my $str = shift; |
131
|
6
|
|
|
|
|
15
|
$str =~ s/\r\n/\n/g; |
132
|
6
|
|
|
|
|
7
|
my @results = (); |
133
|
6
|
|
|
|
|
18
|
foreach ( split "\n", $str ) { |
134
|
10
|
|
|
|
|
32
|
my @result = reverse map{ $self->ǝʇɐʇoɹ($_) } split /\s/, $_; |
|
26
|
|
|
|
|
35
|
|
135
|
10
|
|
|
|
|
26
|
unshift @results, join " ", @result; |
136
|
|
|
|
|
|
|
} |
137
|
6
|
|
|
|
|
34
|
return join "\n", @results; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub ǝʇɐʇoɹ { |
141
|
26
|
|
|
26
|
0
|
22
|
my $self = shift; |
142
|
26
|
|
|
|
|
23
|
my $str = shift; |
143
|
26
|
50
|
|
|
|
122
|
croak $self->ǝʇɐʇoɹ( __PACKAGE__ . " accepts only ascii and their upset." ) |
144
|
|
|
|
|
|
|
unless $str =~ /^(:?[ -~$list]+)$/o; |
145
|
26
|
|
|
|
|
25
|
my @results = (); |
146
|
26
|
|
|
|
|
21
|
my $string = ''; |
147
|
26
|
|
|
|
|
24
|
my $buffer = ''; |
148
|
26
|
|
100
|
|
|
67
|
while ( $string = substr( $str, 0, 1, '' ) or $string eq '0' ){ |
149
|
|
|
|
|
|
|
# some charactors have length 2 even if they were under utf8 |
150
|
189
|
100
|
|
|
|
218
|
if( exists $rot180{$string} ) { |
151
|
187
|
|
|
|
|
204
|
unshift @results, $rot180{$string}; |
152
|
187
|
|
|
|
|
363
|
$buffer = ''; |
153
|
|
|
|
|
|
|
}else{ |
154
|
2
|
|
|
|
|
2
|
$buffer .= $string; |
155
|
2
|
100
|
|
|
|
8
|
next unless exists $rot180{$buffer}; |
156
|
1
|
|
|
|
|
3
|
unshift @results, $rot180{$buffer}; |
157
|
1
|
|
|
|
|
3
|
$buffer = ''; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
} |
160
|
26
|
|
|
|
|
75
|
return join "", @results; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
1; |
164
|
|
|
|
|
|
|
__END__ |