line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Discordian; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7850
|
use Data::Dumper; |
|
1
|
|
|
|
|
11277
|
|
|
1
|
|
|
|
|
73
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
35
|
use 5.006001; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
35
|
|
6
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
43
|
|
7
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
394
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require Exporter; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
14
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
15
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# This allows declaration use Crypt::Discordian ':all'; |
18
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
19
|
|
|
|
|
|
|
# will save memory. |
20
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
) ] ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our @EXPORT = qw( |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Preloaded methods go here. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub normalize { |
36
|
2
|
|
|
2
|
0
|
6
|
my $string = uc(shift); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# remove spaces from string |
39
|
2
|
|
|
|
|
10
|
$string =~ s/\s+//g; |
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
|
|
6
|
$string; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub vowel_shift { |
45
|
1
|
|
|
1
|
0
|
5
|
my $string = normalize(shift); |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
7
|
my $vowel = qr/[AEIOUY]/; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# collect all occurences of vowels in order |
51
|
1
|
|
|
|
|
14
|
my @vowel = ($string =~ m/$vowel/g) ; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# remove all vowels from string |
54
|
1
|
|
|
|
|
7
|
$string =~ s/$vowel//g; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# append all vowels to end of string |
57
|
1
|
|
|
|
|
8
|
$string = "$string$_" for @vowel; |
58
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
5
|
$string; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub encrypt { |
63
|
1
|
|
|
1
|
0
|
596
|
my $string = normalize(shift); |
64
|
1
|
|
|
|
|
3
|
my @string; |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
7
|
$string = vowel_shift $string; |
67
|
1
|
|
|
|
|
4
|
$string = reverse $string; |
68
|
1
|
|
|
|
|
8
|
@string = unpack 'C*', $string; |
69
|
1
|
|
|
|
|
9
|
@string = sort { $a <=> $b } @string; |
|
14
|
|
|
|
|
17
|
|
70
|
1
|
|
|
|
|
7
|
pack 'C*', @string; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
__END__ |