script/phonetize

filter: Statementstmt 100% 23 / 23 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 93.3% 28 / 30 CC 1 SCAR 0.0
CC
1
Cov
96%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Lingua/Alphabet/Phonetic/NATO.pm ↑ Summary
1 #!/usr/local/bin/perl -w
2  
3 =head1 NAME
4  
5 phonetize - print a string in a phonetic alphabet for easy reading
6  
7 =head1 SYNOPSIS
8  
9 phonetize Martin
10  
11 =head1 DESCRIPTION
12  
13 Takes one argument, a "string".
14 Converts each character of "string" to its equivalent "word" in the Phonetic Alphabet.
15 Prints these "words", three "words" per line, one space between "words"
16  
17 In other words, read the output aloud to your military friends and
18 they'll know exactly what you're spelling.
19  
20 =head1 TO DO
21  
22 =over
23  
24 =item Let name of phonetic alphabet be an argument (in case more alphabets get implemented)?
25  
26 =item Handle puncuation somehow?
27  
28 =item Deal with capital vs. lowercase letters somehow?
29  
30 =item Let the "three" in "three words per line" be an argument?
31  
32 =back
33  
34 =head1 AUTHOR
35  
36 Martin Thurn
37  
38 =cut
39  
40 # use Getopt::Long; # later
41 1 ▶use Lingua::Alphabet::Phonetic;
Subroutine BEGIN: called CC=1 SCAR=0.0
42  
43 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
45  
46 1 ▶use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
47 1 $VERSION = do { my @r = (q$Revision: 1.2 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r };
48  
49 1 ▶my $s = shift() || '';
Condition50%1/2
shift @ARGV || ''
l!l
10
MC/DC0%0/1
shift @ARGV || ''
shift @ARGV
Truth table50%1/2
A
A= shift @ARGV
Aresult
11
00
50 # Insert spaces between every letter:
51 1 $s = join(' ', split('', $s));
52 # Insert {CR} after every third letter:
53 1 $s =~ s!(. . .) !$1\n!g;
54 1 my $oMilSpeaker = new Lingua::Alphabet::Phonetic('NATO');
55 1 my @asMilSpeak = $oMilSpeaker->enunciate($s);
56 1 $, = '';
57 1 print @asMilSpeak, "\n";
58 1 exit 0;
59  
60 __END__
« lib/Lingua/Alphabet/Phonetic/NATO.pm ↑ Summary