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   48812 use warnings;
  13         18  
  13         509  
11 13     13   51 use strict;
  13         19  
  13         274  
12              
13 13     13   6422 use Acme::MetaSyntactic::MultiList;
  13         41749  
  13         4142  
14             our @ISA = qw( Acme::MetaSyntactic::MultiList );
15             our $VERSION = '0.04';
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   77 while () {
28 20605 100       72652 if (/^=head2\s+(.*)/) {
    100          
    100          
    100          
29 26         50 _flush_category();
30 26         72 $category2 = lc($1);
31 26         122 $category3 = '';
32             }
33             elsif (/^=head3\s+(.*)/) {
34 91         144 _flush_category();
35 91         558 $category3 = lc($1);
36             }
37             elsif (/=item\s+(.*?)\s*$/) {
38 4901         5786 my $name = $1;
39 4901         7064 $name =~ s/\s+/_/g;
40 4901         5607 $name =~ s/_+/_/g;
41 4901         14409 $seen{$name} = 1;
42             }
43             elsif (/^=head1/) {
44 13         41 last;
45             }
46             }
47 13         35 _flush_category();
48             }
49              
50             sub _flush_category {
51 130 100 100 130   799 if ($category2 and %seen) {
52 91         2358 $data->{names}{$category2}{$category3} = join ' ', sort keys %seen;
53             }
54 130         793 %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.04, the "Guideline" version, released on the 56th
117             anniversary of the downing of Gary Power's U-2 by a SA-2 Guideline.
118              
119             =head1 SYNOPSIS
120              
121             use Acme::MetaSyntactic;
122              
123             my $meta = Acme::MetaSyntactic->new( 'soviet' );
124            
125             print $meta->name(); # return a single name
126             my @names = $meta->name( 4 ); # return 4 distinct names (if possible)
127              
128             If you want some category other than 'electronic', the second line should
129             read:
130              
131             my $meta = Acme::MetaSyntactic->new( 'soviet', category => 'vehicle/aircraft' );
132              
133             If C from L is installed, you can use it
134             from the command line:
135              
136             meta soviet
137              
138             meta soviet/vehicles/submarines
139              
140             =head1 CONTRIBUTOR
141              
142             Jean Forget
143              
144             =head1 SOURCES
145              
146             Note: I have used only sources published I the fall of the
147             Soviet Union. Therefore, the module name is C, with no
148             "ex-" prefix. For each entry, the sources are listed, with page
149             numbers for the books. The games use data cards, which are unnumbered.
150              
151             Some sources, especially early sources, may contain some errors. Some
152             equipment may appear with faulty intelligence reports which give a
153             wrong code or description. And a later intelligence report would
154             correct it. The best example is the Backfire, first given the code
155             "Tu-26" and then the code "Tu-22M".
156              
157             =head2 Main Sources
158              
159             These sources contain extensive lists or extensive tables of soviet
160             equipment.
161              
162             =over 4
163              
164             =item *
165              
166             I
167             written by J-J Patry and P. Lederer
168             published by Editions Presse & Recherche
169             abbreviated as I.
170              
171             =item *
172              
173             I
174             written by Derek Wood
175             published by Janes in 1987
176             (ISBN 0-7106-0343-6)
177             abbreviated as I.
178              
179             =item *
180              
181             I
182             designed by J.D. Webster
183             and published by GDW in 1987
184             (ISBN 0-943580-19-6)
185             abbreviated as I.
186              
187             =item *
188              
189             I
190             designed by J.D. Webster
191             and published by GDW in 1987
192             (ISBN 0-943580-30-7)
193             abbreviated as I.
194              
195             =item *
196              
197             I
198             designed by J.D. Webster
199             and published by GDW in 1988
200             (ISBN 0-943580-97-8)
201             abbreviated as I.
202              
203             =item *
204              
205             I
206             written by H. Le Masson
207             published by Editions Maritimes et Outre-Mer
208             (no ISBN)
209             abbreviated as I.
210              
211             =item *
212              
213             I
214             written by B. Prézelin
215             published by Editions Maritimes et Outre-Mer
216             (ISBN 2.7373.0485.7)
217             abbreviated as I.
218              
219             Note: these last two books are actually the same book, updated and
220             published every other year. You can notice that the title has been
221             shortened between the 1968 issue and the 1990 issue (FDC vs. LFDC).
222              
223             =item *
224              
225             I
226             written by Victor Flintham
227             published by Arms and Armour in 1989
228             (ISBN 0-85368-779-X)
229             abreviated as I.
230              
231             =item *
232              
233             I
234             designed by David Isby
235             published in 1977 by SPI and then in 1983 by TSR
236             (no ISBN)
237             abreviated as I.
238              
239             =back
240              
241             =head2 Minor Sources
242              
243             These sources mention some NATO codes for soviet equipment, but
244             without trying to give an exhaustive list of some category or other.
245              
246             =over 4
247              
248             =item *
249              
250             I
251             designed by Steve Weiss
252             published by Group Three Games in 1985
253             (no ISBN)
254             abreviated as I.
255              
256             =item *
257              
258             I
259             by Randy Cunningham with Jeff Ethell
260             published by Warner Books in 1984
261             ISBN 0-446-35458-9
262             abreviated as I.
263              
264             =item *
265              
266             I
267             by Tom Clancy,
268             first published by Naval Institute Press in 1984
269             published by Fontana in 1987
270             ISBN 0-00-617276-8
271             abreviated at I.
272              
273             =back
274              
275             =head1 SOVIET EQUIPMENT
276              
277             =cut
278              
279             __DATA__