File Coverage

blib/lib/Lingua/Alphabet/Phonetic/NATO.pm
Criterion Covered Total %
statement 15 15 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod n/a
total 21 21 100.0


line stmt bran cond sub pod time code
1              
2             # $Id: NATO.pm,v 1.8 2010-12-02 23:36:28 Martin Exp $
3              
4             =head1 NAME
5              
6             Lingua::Alphabet::Phonetic::NATO - map ABC's to the NATO phonetic letter names
7              
8             =head1 SYNOPSIS
9              
10             This is a specialization of Lingua::Alphabet::Phonetic.
11             You should not use this module;
12             all interaction should be done with an object of type Lingua::Alphabet::Phonetic.
13              
14             =head1 NOTES
15              
16             =head1 SEE ALSO
17              
18             http://en.wikipedia.org/wiki/NATO_phonetic_alphabet
19              
20             =head1 BUGS
21              
22             Please tell the author if you find any!
23              
24             =head1 LICENSE
25              
26             This software is released under the same license as Perl itself.
27              
28             =head1 AUTHOR
29              
30             Martin 'Kingpin' Thurn, C, L.
31              
32             =cut
33              
34             #####################################################################
35              
36             package Lingua::Alphabet::Phonetic::NATO;
37              
38 2     2   4785 use strict;
  2         5  
  2         212  
39 2     2   15 use warnings;
  2         5  
  2         97  
40              
41 2     2   15 use base 'Lingua::Alphabet::Phonetic';
  2         5  
  2         953  
42             our
43             $VERSION = sprintf("%d.%02d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/o);
44              
45             my @asAlphabet = qw(
46             Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel India Juliet Kilo Lima
47             Mike November Oscar Papa Quebec Romeo Sierra Tango Uniform Victor Whiskey
48             Xray Yankee Zulu
49             Zero One Two Three Four Five Six Seven Eight Niner
50             );
51             my %hash = map { $_ => shift @asAlphabet } ('a'..'z', 0..9);
52              
53             sub _name_of_letter
54             {
55 6     6   5 my $self = shift;
56 6         6 my $s = shift;
57             # print STDERR " + L::A::P::NATO::_name_of_letter($s)\n";
58             # If we get more than one character, ignore the rest:
59 6         9 my $c = lc substr($s, 0, 1);
60 6 100       13 if (exists($hash{$c}))
61             {
62 4         13 return $hash{$c};
63             } # if
64 2         11 return $self->SUPER::_name_of_letter($s);
65             } # _name_of_letter
66              
67             1;
68              
69             __END__