blib/lib/Acme/MetaSyntactic/soviet.pm

filter: Statementstmt 100% 33 / 33 Branchbran 91.6% 11 / 12 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 98.1% 54 / 55 SCAR 20.8
CC
8
Cov
98%
_load_data_from_pod
6.0
_flush_category
3.0
BEGIN
1.0
CRAP 8.0
« Build ↑ Summary
1 # -*- encoding: utf-8; indent-tabs-mode: nil -*-
2 #
3 # Acme::MetaSyntactic::soviet -- NATO codenames for Soviet-designed equipment
4 # Copyright (C) 2008, 2012, 2016 Jean Forget
5 #
6 # See the license in the embedded documentation below.
7 #
8 package Acme::MetaSyntactic::soviet;
9  
10 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 14 ▶use Acme::MetaSyntactic::MultiList;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 14 our @ISA = qw( Acme::MetaSyntactic::MultiList );
15 14 our $VERSION = '0.05';
16  
17 14 my $data = { default => 'electronic' };
18 14 my ($category2, $category3);
19 14 my %seen;
20  
21 14 _load_data_from_pod();
22  
23 14 __PACKAGE__->init($data);
24  
25 sub _load_data_from_pod {
26  
27 14 ▶ while (<DATA>) {
Subroutine _load_data_from_pod: called CC=6 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline DATA)) 22484 0 22484
28 22484 ▶ if (/^=head2\s+(.*)/) {
Branch: 4 branches
BranchTrueFalseTotal
if (/^=head2\s+(.*)/) { } 28 22456 22484
elsif (/^=head3\s+(.*)/) { } 98 22358 22456
elsif (/=item\s+(.*?)\s*$/) { } 5306 17052 22358
elsif (/^=head1/) { } 14 17038 17052
29 28 _flush_category();
30 28 $category2 = lc($1);
31 28 $category3 = '';
32 }
33 elsif (/^=head3\s+(.*)/) {
34 98 _flush_category();
35 98 $category3 = lc($1);
36 }
37 elsif (/=item\s+(.*?)\s*$/) {
38 5306 my $name = $1;
39 5306 $name =~ s/\s+/_/g;
40 5306 $name =~ s/_+/_/g;
41 5306 $seen{$name} = 1;
42 }
43 elsif (/^=head1/) {
44 14 last;
45 }
46 }
47 14 _flush_category();
48 }
49  
50 sub _flush_category {
51 140 ▶ if ($category2 and %seen) {
Subroutine _flush_category: called CC=3 SCAR=11.0
Branch: 1 branch
BranchTrueFalseTotal
if ($category2 and %seen) 98 42 140
Condition100%3/3
$category2 and %seen
!ll&&!rl&&r
142898
MC/DC100%2/2
$category2 and %seen
$category2 %seen
Truth table100%3/3
A and B
A= $category2B= %seen
ABresult
0X0
100
111
52 98 $data->{names}{$category2}{$category3} = join ' ', sort keys %seen;
53 }
54 140 %seen = ();
55 }
56  
57 14 38;
58 # Why 38? Hint: s/r$/t/
59  
60 =encoding utf8
61  
62 =head1 NAME
63  
64 Acme::MetaSyntactic::soviet -- NATO codenames for Soviet-designed equipment
65  
66 =head1 DESCRIPTION
67  
68 Some codenames given by NATO to Soviet-designed aircraft, missiles,
69 submarines, radars and other electronic systems. The various
70 categories and sub-categories are
71  
72 =over 4
73  
74 =item *
75  
76 electronic
77  
78 =item *
79  
80 electronic/radars
81  
82 =item *
83  
84 electronic/misc
85  
86 =item *
87  
88 vehicles
89  
90 =item *
91  
92 vehicles/aircraft
93  
94 =item *
95  
96 vehicles/helicopters
97  
98 =item *
99  
100 vehicles/missiles
101  
102 =item *
103  
104 vehicles/submarines
105  
106 =item *
107  
108 vehicles/error
109  
110 =back
111  
112 The default category is 'electronic'.
113  
114 =head1 VERSION
115  
116 This is version 0.05, the "Styx" version, released on the 49th
117 anniversary of the sinking of the Israeli destroyer Eilat by Styx
118 missiles fired from Egyptian patrol boats.
119  
120 =head1 SYNOPSIS
121  
122 use Acme::MetaSyntactic;
123  
124 my $meta = Acme::MetaSyntactic->new( 'soviet' );
125
126 print $meta->name(); # return a single name
127 my @names = $meta->name( 4 ); # return 4 distinct names (if possible)
128  
129 If you want some category other than 'electronic', the second line should
130 read:
131  
132 my $meta = Acme::MetaSyntactic->new( 'soviet', category => 'vehicle/aircraft' );
133  
134 If C<meta> from L<Acme::MetaSyntactic> is installed, you can use it
135 from the command line:
136  
137 meta soviet
138  
139 meta soviet/vehicles/submarines
140  
141 =head1 CONTRIBUTOR
142  
143 Jean Forget
144  
145 =head1 SOURCES
146  
147 Note: I have used only sources published I<before> the fall of the
148 Soviet Union. Therefore, the module name is C<A::MS::soviet>, with no
149 "ex-" prefix. For each entry, the sources are listed, with page
150 numbers for the books. The games use data cards, which are unnumbered.
151  
152 Some sources, especially early sources, may contain some errors. Some
153 equipment may appear with faulty intelligence reports which give a
154 wrong code or description. And a later intelligence report would
155 correct it. The best example is the Backfire, first given the code
156 "Tu-26" and then the code "Tu-22M".
157  
158 =head2 Main Sources
159  
160 These sources contain extensive lists or extensive tables of soviet
161 equipment.
162  
163 =over 4
164  
165 =item *
166  
167 I<Pat-Led-1>
168 written by J-J Patry and P. Lederer
169 published by Editions Presse & Recherche
170 abbreviated as I<PL>.
171  
172 =item *
173  
174 I<Jane's World Aircraft Recognition Handbook>
175 written by Derek Wood
176 published by Janes in 1987
177 (ISBN 0-7106-0343-6)
178 abbreviated as I<JWARH>.
179  
180 =item *
181  
182 I<Air Superiority>
183 designed by J.D. Webster
184 and published by GDW in 1987
185 (ISBN 0-943580-19-6)
186 abbreviated as I<ASu>.
187  
188 =item *
189  
190 I<Air Strike>
191 designed by J.D. Webster
192 and published by GDW in 1987
193 (ISBN 0-943580-30-7)
194 abbreviated as I<ASt>.
195  
196 =item *
197  
198 I<Desert Falcons>
199 designed by J.D. Webster
200 and published by GDW in 1988
201 (ISBN 0-943580-97-8)
202 abbreviated as I<DF>.
203  
204 =item *
205  
206 I<Les Flottes de Combat 1968>
207 written by H. Le Masson
208 published by Editions Maritimes et Outre-Mer
209 (no ISBN)
210 abbreviated as I<LFDC>.
211  
212 =item *
213  
214 I<Flottes de Combat 1990>
215 written by B. Prézelin
216 published by Editions Maritimes et Outre-Mer
217 (ISBN 2.7373.0485.7)
218 abbreviated as I<FDC>.
219  
220 Note: these last two books are actually the same book, updated and
221 published every other year. You can notice that the title has been
222 shortened between the 1968 issue and the 1990 issue (FDC vs. LFDC).
223  
224 =item *
225  
226 I<Air Wars and Aircraft>
227 written by Victor Flintham
228 published by Arms and Armour in 1989
229 (ISBN 0-85368-779-X)
230 abbreviated as I<AWA>.
231  
232 =item *
233  
234 I<Air War>
235 designed by David Isby
236 published in 1977 by SPI and then in 1983 by TSR
237 (no ISBN)
238 abbreviated as I<SPIAW>.
239  
240 =item *
241  
242 I<How to Make War>
243 written by James F. Dunigan
244 published by Quill in 1988
245 (ISBN 0-668-07979-2)
246 abbreviated as I<HTMW>.
247  
248 =back
249  
250 =head2 Minor Sources
251  
252 These sources mention some NATO codes for soviet equipment, but
253 without trying to give an exhaustive list of some category or other.
254  
255 =over 4
256  
257 =item *
258  
259 I<Rolling Thunder>
260 designed by Steve Weiss
261 published by Group Three Games in 1985
262 (no ISBN)
263 abbreviated as I<RT>.
264  
265 =item *
266  
267 I<Fox Two>
268 by Randy Cunningham with Jeff Ethell
269 published by Warner Books in 1984
270 ISBN 0-446-35458-9
271 abbreviated as I<F2>.
272  
273 =item *
274  
275 I<The Hunt for Red October>
276 by Tom Clancy,
277 first published by Naval Institute Press in 1984
278 published by Fontana in 1987
279 ISBN 0-00-617276-8
280 abbreviated at I<THFRO>.
281  
282 =item *
283  
284 I<Red Storm Rising>
285 by Tom Clancy,
286 first published by G.P. Putnam's Sons in 1986,
287 published by Berkley International Edition in 1987
288 ISBN 0-425-10242-4
289 abbreviated as I<RSR>.
290  
291 =back
292  
293 =head1 SOVIET EQUIPMENT
294  
295 =cut
296  
297 __DATA__
« Build ↑ Summary