File Coverage

blib/lib/Lingua/Alphabet/Phonetic/LAPD.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             package Lingua::Alphabet::Phonetic::LAPD;
2              
3 2     2   2151 use strict;
  2         6  
  2         101  
4 2     2   14 use warnings;
  2         6  
  2         87  
5 2     2   27 use base 'Lingua::Alphabet::Phonetic';
  2         4  
  2         1763  
6              
7             # ABSTRACT: map ABC's to the LAPD phonetic letter names
8             our $VERSION = '0.02'; # VERSION
9              
10             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             my %hash = map { $_ => shift @asAlphabet } ('a'..'z', 0..9);
18              
19             sub _name_of_letter
20             {
21 6     6   66 my $self = shift;
22 6         7 my $s = shift;
23             # If we get more than one character, ignore the rest:
24 6         12 my $c = lc substr($s, 0, 1);
25 6 100       16 if (exists($hash{$c}))
26             {
27 4         28 return $hash{$c};
28             } # if
29 2         11 return $self->SUPER::_name_of_letter($s);
30             } # _name_of_letter
31              
32             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
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.
61             You do not use this module directly. All interaction
62             should be through an L.
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
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__