line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Toalpha; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
121123
|
use 5.008001; |
|
4
|
|
|
|
|
17
|
|
|
4
|
|
|
|
|
174
|
|
4
|
4
|
|
|
4
|
|
25
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
163
|
|
5
|
4
|
|
|
4
|
|
39
|
use warnings; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
3860
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw(toalpha fromalpha) ] ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our @EXPORT = qw(); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# NOTE: This module is NOT a good example of how to do this kind of task. |
20
|
|
|
|
|
|
|
# Also, the purpose of it is not very apperant. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# This code is messy, but I don't know a better way to do this. |
23
|
|
|
|
|
|
|
my @table = ( 'aa' .. 'zz' ); |
24
|
|
|
|
|
|
|
my %out_table; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Build %out_table. Messier. If you are a clean freak, abort now ;-). |
27
|
|
|
|
|
|
|
for (0 .. $#table) { |
28
|
|
|
|
|
|
|
$out_table{$table[$_]} = chr($_); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub toalpha { |
32
|
2
|
|
|
2
|
0
|
17
|
my $in = shift; |
33
|
2
|
|
|
|
|
4
|
my $out = $in; |
34
|
2
|
|
|
|
|
24
|
$out =~ s/(.)/$table[ord($1)]/g; |
35
|
2
|
|
|
|
|
15
|
return $out; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub fromalpha { |
39
|
2
|
|
|
2
|
0
|
12
|
my $in = shift; |
40
|
2
|
|
|
|
|
4
|
my $out = $in; |
41
|
2
|
|
|
|
|
13
|
$out =~ s/(..)/$out_table{$1}/eg; |
|
6
|
|
|
|
|
22
|
|
42
|
2
|
|
|
|
|
16
|
return $out; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
__END__ |