File Coverage

blib/lib/Acme/MetaSyntactic/soviet.pm
Criterion Covered Total %
statement 25 25 100.0
branch 10 10 100.0
condition 3 3 100.0
subroutine 5 5 100.0
pod n/a
total 43 43 100.0


line stmt bran cond sub pod time code
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 13     13   29234 use warnings;
  13         18  
  13         413  
11 13     13   40 use strict;
  13         11  
  13         200  
12              
13 13     13   5195 use Acme::MetaSyntactic::MultiList;
  13         33264  
  13         3627  
14             our @ISA = qw( Acme::MetaSyntactic::MultiList );
15             our $VERSION = '0.05';
16              
17             my $data = { default => 'electronic' };
18             my ($category2, $category3);
19             my %seen;
20              
21             _load_data_from_pod();
22              
23             __PACKAGE__->init($data);
24              
25             sub _load_data_from_pod {
26              
27 13     13   59 while () {
28 20878 100       56628 if (/^=head2\s+(.*)/) {
    100          
    100          
    100          
29 26         38 _flush_category();
30 26         59 $category2 = lc($1);
31 26         94 $category3 = '';
32             }
33             elsif (/^=head3\s+(.*)/) {
34 91         120 _flush_category();
35 91         493 $category3 = lc($1);
36             }
37             elsif (/=item\s+(.*?)\s*$/) {
38 4927         4612 my $name = $1;
39 4927         5717 $name =~ s/\s+/_/g;
40 4927         4691 $name =~ s/_+/_/g;
41 4927         11374 $seen{$name} = 1;
42             }
43             elsif (/^=head1/) {
44 13         22 last;
45             }
46             }
47 13         25 _flush_category();
48             }
49              
50             sub _flush_category {
51 130 100 100 130   622 if ($category2 and %seen) {
52 91         1987 $data->{names}{$category2}{$category3} = join ' ', sort keys %seen;
53             }
54 130         621 %seen = ();
55             }
56              
57             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 from L 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 the fall of the
148             Soviet Union. Therefore, the module name is C, 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
168             written by J-J Patry and P. Lederer
169             published by Editions Presse & Recherche
170             abbreviated as I.
171              
172             =item *
173              
174             I
175             written by Derek Wood
176             published by Janes in 1987
177             (ISBN 0-7106-0343-6)
178             abbreviated as I.
179              
180             =item *
181              
182             I
183             designed by J.D. Webster
184             and published by GDW in 1987
185             (ISBN 0-943580-19-6)
186             abbreviated as I.
187              
188             =item *
189              
190             I
191             designed by J.D. Webster
192             and published by GDW in 1987
193             (ISBN 0-943580-30-7)
194             abbreviated as I.
195              
196             =item *
197              
198             I
199             designed by J.D. Webster
200             and published by GDW in 1988
201             (ISBN 0-943580-97-8)
202             abbreviated as I.
203              
204             =item *
205              
206             I
207             written by H. Le Masson
208             published by Editions Maritimes et Outre-Mer
209             (no ISBN)
210             abbreviated as I.
211              
212             =item *
213              
214             I
215             written by B. Prézelin
216             published by Editions Maritimes et Outre-Mer
217             (ISBN 2.7373.0485.7)
218             abbreviated as I.
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
227             written by Victor Flintham
228             published by Arms and Armour in 1989
229             (ISBN 0-85368-779-X)
230             abbreviated as I.
231              
232             =item *
233              
234             I
235             designed by David Isby
236             published in 1977 by SPI and then in 1983 by TSR
237             (no ISBN)
238             abbreviated as I.
239              
240             =item *
241              
242             I
243             written by James F. Dunigan
244             published by Quill in 1988
245             (ISBN 0-668-07979-2)
246             abbreviated as I.
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
260             designed by Steve Weiss
261             published by Group Three Games in 1985
262             (no ISBN)
263             abbreviated as I.
264              
265             =item *
266              
267             I
268             by Randy Cunningham with Jeff Ethell
269             published by Warner Books in 1984
270             ISBN 0-446-35458-9
271             abbreviated as I.
272              
273             =item *
274              
275             I
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.
281              
282             =item *
283              
284             I
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.
290              
291             =back
292              
293             =head1 SOVIET EQUIPMENT
294              
295             =cut
296              
297             __DATA__