File Coverage

blib/lib/Lingua/Alphabet/Phonetic/StarWars.pm
Criterion Covered Total %
statement 15 16 93.7
branch 3 4 75.0
condition n/a
subroutine 4 4 100.0
pod n/a
total 22 24 91.6


line stmt bran cond sub pod time code
1              
2             # $Id: StarWars.pm,v 1.2 2010-09-12 14:11:40 Martin Exp $
3              
4             =head1 NAME
5              
6             Lingua::Alphabet::Phonetic::StarWars - map ASCII characters to names of Star Wars characters
7              
8             =head1 SYNOPSIS
9              
10             This is a specialization of L.
11             You should not use this module directly;
12             all interaction should be done with an object of type Lingua::Alphabet::Phonetic.
13              
14             my $oSpeaker = new Lingua::Alphabet::Phonetic('StarWars');
15              
16             =head1 NOTES
17              
18             =head1 SEE ALSO
19              
20             http://www.wookieepedia.org
21              
22             =head1 BUGS
23              
24             Please tell the author if you find any!
25              
26             =head1 AUTHOR
27              
28             Martin 'Kingpin' Thurn, C, L.
29              
30             =head1 LICENSE
31              
32             This software is released under the same license as Perl itself.
33              
34             =cut
35              
36             #####################################################################
37              
38             package Lingua::Alphabet::Phonetic::StarWars;
39              
40 2     2   46236 use strict;
  2         5  
  2         77  
41 2     2   14 use warnings;
  2         4  
  2         66  
42              
43 2     2   23 use base 'Lingua::Alphabet::Phonetic';
  2         3  
  2         1974  
44             our
45             $VERSION = sprintf("%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/o);
46              
47             my @as = qw(
48             Ackbar
49             Bantha
50             Chewbacca
51             Dengar
52             Evazan
53             Fisto
54             Greedo
55             Hutt
56             Isolder
57             Jedi
58             Kenobi
59             Leia
60             Mothma
61             Needa
62             Organa
63             Palpatine
64             Quadinaros
65             Ree-Yees
66             Skywalker
67             Tyranus
68             Ugnaught
69             Vader
70             Wampa
71             X-wing
72             Yoda
73             Zuckuss
74             );
75             my %hash = map { uc substr($_,0,1) => $_ } @as;
76              
77             sub _name_of_letter
78             {
79 26     26   2396 my $self = shift;
80 26         37 my $s = shift;
81             # print STDERR " + L::A::P::StarWars::_name_of_letter($s)\n";
82             # If we get more than one character, ignore the rest:
83 26         44 my $c = uc substr($s, 0, 1);
84             # This module throws out punctuation:
85 26 100       90 return if $c !~ m/[A-Z0-9]/;
86 22 50       47 if (exists($hash{$c}))
87             {
88 22         71 return $hash{$c};
89             } # if
90 0           return $self->SUPER::_name_of_letter($s);
91             } # _name_of_letter
92              
93             1;
94              
95             __END__