line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
1506
|
use 5.008; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
82
|
|
2
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
56
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
122
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Crypt::Role::LatinAlphabet; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.003'; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
11
|
use Moo::Role; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
11
|
2
|
|
|
2
|
|
739
|
use Const::Fast; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
12
|
2
|
|
|
2
|
|
12553
|
use Text::Unidecode; |
|
2
|
|
|
|
|
7595
|
|
|
2
|
|
|
|
|
316
|
|
13
|
2
|
|
|
2
|
|
21
|
use Type::Params; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
25
|
|
14
|
2
|
|
|
2
|
|
547
|
use Types::Standard qw(Str); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
19
|
|
15
|
2
|
|
|
2
|
|
2110
|
use namespace::sweep; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
48
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
const my $alphabet => [ 'A' .. 'I', 'K' .. 'Z' ]; |
18
|
|
|
|
|
|
|
|
19
|
4
|
|
|
4
|
1
|
84
|
sub alphabet { $alphabet } |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $_check_preprocess; |
22
|
|
|
|
|
|
|
sub preprocess |
23
|
|
|
|
|
|
|
{ |
24
|
3
|
|
66
|
3
|
1
|
20
|
$_check_preprocess ||= compile(Str); |
25
|
|
|
|
|
|
|
|
26
|
3
|
|
|
|
|
1112
|
my $self = shift; |
27
|
3
|
|
|
|
|
14
|
my ($input) = $_check_preprocess->(@_); |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
1
|
|
10
|
my $str = unidecode uc $input; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
|
3
|
|
|
|
|
78
|
|
30
|
3
|
|
|
|
|
37559
|
$str =~ s/J/I/g; |
31
|
3
|
|
|
|
|
17
|
$str; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=pod |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=encoding utf-8 |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Crypt::Role::LatinAlphabet - twenty-five letter Latin alphabet for classic cryptography |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 DESCRIPTION |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This role provides a twenty-five letter alphabet (does not include J) |
49
|
|
|
|
|
|
|
for use in classic cryptography. The letters are all uppercase. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 Object Methods |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=over |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item C<< alphabet >> |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Returns the alphabet as an arrayref of letters. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item C<< preprocess($str) >> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Perform pre-encipher processing on a string. The string is uppercased; |
62
|
|
|
|
|
|
|
non-ASCII characters are replaced with ASCII equivalents; the letter |
63
|
|
|
|
|
|
|
B<J> is replaced with B<I>. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Punctuation characters, spaces, etc are I<not> removed from the string. |
66
|
|
|
|
|
|
|
It is the choice of the cipher whether to, say, pass them through |
67
|
|
|
|
|
|
|
unchanged, or strip them from the ciphertext. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=back |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 BUGS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Please report any bugs to |
74
|
|
|
|
|
|
|
L<http://rt.cpan.org/Dist/Display.html?Queue=Crypt-Polybius>. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SEE ALSO |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
L<Crypt::Polybius>. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 AUTHOR |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Toby Inkster E<lt>tobyink@cpan.orgE<gt>. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Toby Inkster. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
89
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
94
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
95
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
96
|
|
|
|
|
|
|
|