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