blib/lib/Lingua/Alphabet/Phonetic/LAPD.pm

filter: Statementstmt 100% 20 / 20 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 26 / 26 CC 2 SCAR 3.4
CC
2
Cov
100%
_name_of_letter
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
↑ Summary
1 package Lingua::Alphabet::Phonetic::LAPD;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use base 'Lingua::Alphabet::Phonetic';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # ABSTRACT: map ABC's to the LAPD phonetic letter names
8 2 our $VERSION = '0.02'; # VERSION
9  
10 2 my @asAlphabet = qw(
11 Adam Boy Charles David Edward Frank George
12 Henry Ida John King Lincoln Mary Nora Ocean
13 Paul Queen Robert Sam Tom Union Victor William
14 X-ray Young Zebra Zero One Two Three Four Five
15 Six Seven Eight Nine
16 );
17 2 my %hash = map { $_ => shift @asAlphabet } ('a'..'z', 0..9);
18  
19 sub _name_of_letter
20 6 ▶ {
Subroutine _name_of_letter: called CC=2 SCAR=6.9
21 6 my $self = shift;
22 6 my $s = shift;
23 # If we get more than one character, ignore the rest:
24 6 my $c = lc substr($s, 0, 1);
25 6 ▶ if (exists($hash{$c}))
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash{$c}) 4 2 6
26 {
27 4 return $hash{$c};
28 } # if
29 2 return $self->SUPER::_name_of_letter($s);
30 } # _name_of_letter
31  
32 2 1;
33  
34  
35  
36 =pod
37  
38 =head1 NAME
39  
40 Lingua::Alphabet::Phonetic::LAPD - map ABC's to the LAPD phonetic letter names
41  
42 =head1 VERSION
43  
44 version 0.02
45  
46 =head1 SYNOPSIS
47  
48 use Lingua::Alphabet::Phonetic;
49 my $phonetic = Lingua::Alphabet::Phonetic('LAPD');
50 # prints One-Adam-OneTwo
51 print $phonetic->enunciate("1-A-12");
52  
53 =head1 DESCRIPTION
54  
55 This module provides for L<Lingua::Alphabet::Phonetic>
56 the LAPD phonetic alphabet used by the Los Angeles Police
57 Department (LAPD) and other local state law enforcement
58 agencies across the state of California.
59  
60 This is a specialization of L<Lingua::Alphabet::Phonetic>.
61 You do not use this module directly. All interaction
62 should be through an L<Lingua::Alphabet::Phonetic>.
63  
64 =head1 INSPIRATION
65  
66 I wrote this module along with a number of other back ends
67 for L::A::P years ago for a gimmick on my website. Recently
68 I was watching Adam-12 on Netflix and decided this was a sign
69 that this module should be shared.
70  
71 Unfortunately 1-A-12 comes back as 1-Adam-OneTwo instead of
72 1-Adam-Twelve.
73  
74 =head1 AUTHOR
75  
76 Graham Ollis <plicease@cpan.org>
77  
78 =head1 COPYRIGHT AND LICENSE
79  
80 This software is copyright (c) 2012 by Graham Ollis.
81  
82 This is free software; you can redistribute it and/or modify it under
83 the same terms as the Perl 5 programming language system itself.
84  
85 =cut
86  
87  
88 __END__
↑ Summary