blib/lib/Geo/METARTAF.pm

filter: Statementstmt 20.8% 98 / 470 Branchbran 0.0% 0 / 246 Conditioncond 0.0% 0 / 176 MC/DCmcdc 0.0% 0 / 105 Subroutinesub 40.6% 24 / 59 Podpod 100% 9 / 9 totaltotal 12.3% 131 / 1065 CC 187 SCAR 90.0
CC
187
Cov
11%
decode
15750.0
as_html
240.0
as_string
156.0
CRAP 8065.8
↑ Summary
1 # A module to decode North American METAR's and TAF's
2 # Based on Geo::TAF (Designed for European METAR's/TAF's)
3 # but updated with information from Transport Canada AIM.
4 # These changes may cause the module to fail with European data.
5 # Copyright (c) 2025 Peter Carter
6 # Version Date Description
7 # ------- ---------- --------------------------------------
8 # 1.00 2025-01-03 First version
9 # 1.01 2025-01-12 Fixed issue when decoding 11th, 12th,
10 # and 13th (they were displayed as 11st,
11 # 12nd, and 13rd).
12 # 1.02 2025-01-13 Fixed two issues: error code display
13 # and vicinity (VC) phenomena display.
14 # 1.03 2025-01-21 Fixed an issue with decoding certain RVR
15 # data and resolved the errors generated in
16 # the Apache log when used by a CGI script.
17  
18 package Geo::METARTAF;
19  
20 1 ▶use 5.005;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 1 $VERSION = '1.03';
25  
26 1 my %err = (
27 '0' => "",
28 '1' => "No valid ICAO designator",
29 '2' => "Length is less than 15 characters",
30 '3' => "No valid issue time",
31 '4' => "Expecting METAR, SPECI, or TAF at the beginning",
32 );
33  
34 1 my %clt = (
35 SKC => 1,
36 CLR => 1,
37 NSC => 1,
38 BLU => 1,
39 WHT => 1,
40 GRN => 1,
41 YLO => 1,
42 AMB => 1,
43 RED => 1,
44 BKN => 1,
45 NIL => 1,
46 );
47  
48 1 my %ignore = (
49 AUTO => 1,
50 COR => 1,
51 );
52  
53 1 my $report_type = '';
54
55 # Module methods
56  
57 # Create a new object
58 sub new
59 0 ▶{
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
60 0 my $pkg = shift;
61 0 my $self = bless {@_}, $pkg;
62 0 ▶ $self->{decode_language} ||= "Geo::METARTAF::EN";
Condition0%0/2
$self->{"decode_language"} ||= "Geo::METARTAF::EN"
l!l
00
MC/DC0%0/1
$self->{"decode_language"} ||= "Geo::METARTAF::EN"
$self->{"decode_language"}
Truth table0%0/2
A
A= $self->{"decode_language"}
Aresult
11
00
63 0 return $self;
64 }
65  
66 # Precede input data with 'METAR' and decode
67 sub metar
68 0 ▶{
Subroutine metar: not called CC=2 SCAR=17.9
Pod documented
69 0 my $self = shift;
70 0 my $l = shift;
71 0 ▶ $l = 'METAR ' . $l unless $l =~ /^\s*(?:METAR|TAF|SPECI)\s/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $l =~ /^\s*(?:METAR|TAF|SPECI)\s/i 0 0 0
72 0 return $self->decode($l);
73 }
74  
75 # Precede input data with 'SPECI' and decode
76 sub speci
77 0 ▶{
Subroutine speci: not called CC=2 SCAR=17.9
Pod documented
78 0 my $self = shift;
79 0 my $l = shift;
80 0 ▶ $l = 'SPECI ' . $l unless $l =~ /^\s*(?:METAR|TAF|SPECI)\s/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $l =~ /^\s*(?:METAR|TAF|SPECI)\s/i 0 0 0
81 0 return $self->decode($l);
82 }
83  
84 # Precede input data with 'TAF' and decode
85 sub taf
86 0 ▶{
Subroutine taf: not called CC=2 SCAR=17.9
Pod documented
87 0 my $self = shift;
88 0 my $l = shift;
89 0 ▶ $l = 'TAF ' . $l unless $l =~ /^\s*(?:METAR|TAF|SPECI)\s/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $l =~ /^\s*(?:METAR|TAF|SPECI)\s/i 0 0 0
90 0 return $self->decode($l);
91 }
92  
93 # Format and print decoded data as a string
94 sub as_string
95 0 ▶{
Subroutine as_string: not called CC=4 SCAR=30.0
Pod documented
96 0 my $self = shift;
97 0 my $decoded_data = '';
98 0 my $subsection = '';
99 0 for (@{$self->{sections}}) {
100 0 my $line = $_->as_string;
101 0 ▶ if ($line =~ /^~/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /^~/) { } 0 0 0
102 0 my ($section_name, $section_data) = $line =~ /^~(.+?:)(.+)/;
103 0 ▶ if ($subsection eq $section_name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($subsection eq $section_name) { } 0 0 0
104 0 $decoded_data .= " $section_data\n";
105 }
106 else {
107 0 $decoded_data .= " $section_name\n";
108 0 $decoded_data .= " $section_data\n";
109 0 $subsection = $section_name;
110 }
111 }
112 else {
113 0 $decoded_data .= "$line\n";
114 0 $subsection = '';
115 }
116 }
117 0 return $decoded_data;
118 }
119  
120 # Format and print decoded data as an HTML table
121 sub as_html
122 0 ▶{
Subroutine as_html: not called CC=15 SCAR=54.8
Pod documented
123 0 my $self = shift;
124 0 my $decoded_data = '<table class="metartaf_table">' . "\n";
125 0 my $subsection = '';
126 0 my $endTr = 0;
127 0 for (@{$self->{sections}}) {
128 0 my $line = $_->as_string;
129 0 chomp $line;
130 0 ▶ if ($line =~ /^~/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /^~/) { } 0 0 0
131 0 my ($section_name, $section_data) = $line =~ /^~(.+?:)(.+)/;
132 0 ▶ if ($subsection eq $section_name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($subsection eq $section_name) { } 0 0 0
133 0 $decoded_data .= '<br>' . $section_data;
134 }
135 else {
136 0 ▶ $decoded_data .= "</td>\n</tr>\n" if ($endTr);
Branch: 1 branch
BranchTrueFalseTotal
if $endTr 0 0 0
137 0 $decoded_data .= "<tr>\n";
138 0 $decoded_data .= ' <td class="metartaf_data_type">' . $section_name . '</td>' . "\n";
139 0 $decoded_data .= ' <td class="metartaf_data_info">' . $section_data;
140 0 $subsection = $section_name;
141 0 $endTr = 1;
142 }
143 }
144 else {
145 0 ▶ if ($endTr) {
Branch: 1 branch
BranchTrueFalseTotal
if ($endTr) 0 0 0
146 0 $decoded_data .= "</td>\n</tr>\n";
147 0 $endTr = 0;
148 }
149 0 ▶ if ($line =~ /METAR|SPECI|TAF/) {
Branch: 7 branches
BranchTrueFalseTotal
if ($line =~ /METAR|SPECI|TAF/) { } 0 0 0
elsif ($line =~ /^Valid/) { } 0 0 0
elsif ($line =~ /^Temporarily/) { } 0 0 0
elsif ($line =~ /^Probability/) { } 0 0 0
elsif ($line =~ /^Becoming/) { } 0 0 0
elsif ($line =~ /^From/) { } 0 0 0
elsif ($line =~ /^Until/) { } 0 0 0
150 0 $decoded_data .= "<tr>\n" . '<td colspan="2" class="metartaf_report">' . $line . "</td>\n</tr>\n";
151 }
152 elsif ($line =~ /^Valid/) {
153 0 $decoded_data .= "<tr>\n" . '<td colspan="2" class="metartaf_validity">' . $line . "</td>\n</tr>\n";
154 }
155 elsif ($line =~ /^Temporarily/) {
156 0 $decoded_data .= "<tr>\n" . '<td colspan="2" class="metartaf_tempo">' . $line . "</td>\n</tr>\n";
157 }
158 elsif ($line =~ /^Probability/) {
159 0 $decoded_data .= "<tr>\n" . '<td colspan="2" class="metartaf_prob">' . $line . "</td>\n</tr>\n";
160 }
161 elsif ($line =~ /^Becoming/) {
162 0 $decoded_data .= "<tr>\n" . '<td colspan="2" class="metartaf_becmg">' . $line . "</td>\n</tr>\n";
163 }
164 elsif ($line =~ /^From/) {
165 0 $decoded_data .= "<tr>\n" . '<td colspan="2" class="metartaf_fm">' . $line . "</td>\n</tr>\n";
166 }
167 elsif ($line =~ /^Until/) {
168 0 $decoded_data .= "<tr>\n" . '<td colspan="2" class="metartaf_tl">' . $line . "</td>\n</tr>\n";
169 }
170 else {
171 0 $decoded_data .="<tr>\n" . '<td colspan="2" class="metartaf_unknown">' . $line . "</td>\n</tr>\n";
172 }
173 0 $subsection = '';
174 }
175 }
176 0 ▶ $decoded_data .= "</td>\n</tr>\n" if ($endTr);
Branch: 1 branch
BranchTrueFalseTotal
if $endTr 0 0 0
177 0 $decoded_data .= "</table>";
178 0 ▶ $decoded_data =~ s/°/&deg;/g if $decoded_data =~ /°/;
Branch: 1 branch
BranchTrueFalseTotal
if $decoded_data =~ /\302\260/ 0 0 0
179 0 return $decoded_data;
180 }
181  
182 # Return input data with excess spaces removed
183 sub minimal
184 0 ▶{
Subroutine minimal: not called CC=1 SCAR=6.9
Pod documented
185 0 return shift->{line};
186 }
187  
188 # Return error codes
189 sub error
190 0 ▶{
Subroutine error: not called CC=1 SCAR=6.9
Pod documented
191 0 my $self = shift;
192 0 return $err{$self->error_code} . "\n";
193 }
194  
195 # Decode input data
196 sub decode
197 0 ▶{
Subroutine decode: not called CC=125 SCAR=96.6
Pod documented
198 0 my $self = shift;
199 0 my $l = uc shift;
200  
201 0 $self->{amendedOrCorrected} = '';
202  
203 0 $l =~ s/=$//;
204  
205 0 ▶ unless (length $l > 15) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $l > 15) 0 0 0
206 0 $self->{error_code} = 2;
207 0 return;
208 }
209
210 0 my @tok = split /\s+/, $l;
211  
212 0 $self->{line} = join ' ', @tok;
213
214 # Do we explicitly have a METAR, SPECI, or a TAF
215 0 my $t = shift @tok;
216 0 ▶ if ($t eq 'TAF') {
Branch: 2 branches
BranchTrueFalseTotal
if ($t eq 'TAF') { } 0 0 0
elsif ($t eq 'METAR' or $t eq 'SPECI') { } 0 0 0
217 0 $self->{taf} = 1;
218 0 $self->{report} = $t;
219 ▶ } elsif ($t eq 'METAR' || $t eq 'SPECI') {
Condition0%0/3
$t eq "METAR" or $t eq "SPECI"
l!l&&r!l&&!r
000
MC/DC0%0/2
$t eq "METAR" or $t eq "SPECI"
$t eq "METAR" $t eq "SPECI"
Truth table0%0/3
A or B
A= $t eq "METAR"B= $t eq "SPECI"
ABresult
1X1
011
000
220 0 $self->{taf} = 0;
221 0 $self->{report} = $t;
222 } else {
223 0 $self->{error_code} = 4;
224 0 return;
225 }
226  
227 # The next token may be "AMD" (amended) if it is a TAF
228 0 ▶ if ($self->{taf} && $tok[0] eq 'AMD') {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"taf"} and $tok[0] eq "AMD") 0 0 0
Condition0%0/3
$self->{"taf"} and $tok[0] eq "AMD"
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"taf"} and $tok[0] eq "AMD"
$self->{"taf"} $tok[0] eq "AMD"
Truth table0%0/3
A and B
A= $self->{"taf"}B= $tok[0] eq "AMD"
ABresult
0X0
100
111
229 0 $self->{amendedOrCorrected} = '(Amended/Corrected)';
230 0 shift @tok;
231 }
232  
233 # The next token is the ICAO designator
234 0 $t = shift @tok;
235 0 ▶ if ($t =~ /^[A-Z]{4}$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($t =~ /^[A-Z]{4}$/) { } 0 0 0
236 0 $self->{icao} = $t;
237 } else {
238 0 $self->{error_code} = 1;
239 0 return;
240 }
241  
242 # The next token is the issue / observation date and time
243 0 $t = shift @tok;
244 0 ▶ if (my ($day, $time) = $t =~ /^(\d\d)(\d{4})Z?$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = $t =~ /^(\d\d)(\d{4})Z?$/) { } 0 0 0
245 0 $self->{day} = $day;
246 0 $self->{time} = _time($time) . ' UTC';
247 } else {
248 0 $self->{error_code} = 3;
249 0 return;
250 }
251  
252 # The next token may be "CCx" (corrected) and/or AUTO (AWOS) if it is a METAR/SPECI
253 0 ▶ while (!$self->{taf} && $tok[0] =~ /^AUTO|CC[A-Z]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->{"taf"} and $tok[0] =~ /^AUTO|CC[A-Z]$/) 0 0 0
Condition0%0/3
not $self->{"taf"} and $tok[0] =~ /^AUTO|CC[A-Z]$/
!ll&&!rl&&r
000
MC/DC0%0/2
not $self->{"taf"} and $tok[0] =~ /^AUTO|CC[A-Z]$/
not $self->{"taf"} $tok[0] =~ /^AUTO|CC[A-Z]$/
Truth table0%0/3
not(A) and B
A= not $self->{"taf"}B= $tok[0] =~ /^AUTO|CC[A-Z]$/
ABresult
0X0
100
111
254 0 ▶ if ($tok[0] eq 'AUTO') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tok[0] eq 'AUTO') { } 0 0 0
255 0 $self->{amendedOrCorrected} .= 'reported by AWOS ';
256 0 shift @tok;
257 }
258 else {
259 0 my ($revLetter) = $tok[0] =~ /CC([A-Z])/;
260 0 my $revNumber = ord($revLetter) - 64;
261 0 $self->{amendedOrCorrected} .= "(Correction # $revNumber) ";
262 0 shift @tok;
263 }
264 }
265  
266 # If it is a TAF then expect a validity period
267 0 ▶ if ($self->{taf}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"taf"}) 0 0 0
268 0 ▶ if (my ($v_from_day, $v_from_hour, $v_to_day, $v_to_hour) = $tok[0] =~ /^(\d{2})(\d{2})\/(\d{2})(\d{2})$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = $tok[0] =~ m[^(\d{2})(\d{2})/(\d{2})(\d{2})$]) 0 0 0
269 0 $self->{valid_from_day} = $v_from_day;
270 0 $self->{valid_from_hour} = _time($v_from_hour * 100) . ' UTC';
271 0 $self->{valid_to_day} = $v_to_day;
272 0 $self->{valid_to_hour} = _time($v_to_hour * 100) . ' UTC';
273 0 $self->{valid_from} = "$v_from_hour:00 UTC on $v_from_day";
274 0 $self->{valid_to} = "$v_to_hour:00 UTC on $v_to_day";
275 0 shift @tok;
276 }
277 }
278  
279 # Next is the 'list' of things that can repeat over and over
280  
281 0 my $ceiling = 100000;
282  
283 my @section = (
284 $self->_section('HEAD', $self->{report}, $self->{icao}, $self->{day}, $self->{time}, $self->{amendedOrCorrected})
285 0 );
286
287 0 ▶ push @section, $self->_section('VALID', $self->{valid_from_day}, $self->{valid_from_hour}, $self->{valid_to_day}, $self->{valid_to_hour}) if $self->{valid_from_day};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"valid_from_day"} 0 0 0
288  
289 0 ▶ while (@tok) {
Branch: 1 branch
BranchTrueFalseTotal
if (@tok) 0 0 0
290 0 $t = shift @tok;
291
292 # Temporary or Becoming
293 0 ▶ if ($t eq 'TEMPO' || $t eq 'BECMG') {
Branch: 23 branches
BranchTrueFalseTotal
if ($t eq 'TEMPO' or $t eq 'BECMG') { } 0 0 0
elsif ($ignore{$t}) { } 0 0 0
elsif ($t eq 'NOSIG' or $t eq 'NSW') { } 0 0 0
elsif ($t eq 'BKN') { } 0 0 0
elsif ($clt{$t}) { } 0 0 0
elsif ($t eq 'CAVOK') { } 0 0 0
elsif ($t eq 'RMK') { } 0 0 0
elsif (() = $t =~ /^FM(\d{2})(\d{4})$/) { } 0 0 0
elsif (() = $t =~ /^TL(\d{2})(\d{4})$/) { } 0 0 0
elsif (my($percent) = $t =~ /^PROB(\d\d)$/) { } 0 0 0
elsif (() = $t =~ /^(RWY?|LDG)(\d\d[RLC]?)$/) { } 0 0 0
elsif (() = $t =~ /^(\d\d\d|VRB)(\d\d)(?:G(\d\d))?(KT|MPH|MPS|KMH)$/) { } 0 0 0
elsif (() = $t =~ /^([QA])(?:NH)?(\d\d\d\d)(INS?)?$/) { } 0 0 0
elsif ($t eq 'WS') { } 0 0 0
elsif (() = $t =~ m[^WS(\d{3})\/(\d{3})(\d+)KT$]) { } 0 0 0
elsif (() = $t =~ /^(\d\d\d\d[NSEW]{0,2})([A-Z][A-Z])?$/) { } 0 0 0
elsif (($visibility) = $t =~ /^(\d+)KM$/) { } 0 0 0
elsif (my($m) = $t =~ /^(\d)$/) { } 0 0 0
elsif (() = $t =~ m[^([MP])?(\d+(:?/\d)?)SM$]) { } 0 0 0
elsif (() = $t =~ m[^R(\d\d[LRC]?)/([MP])?(\d\d\d\d)(?:([VMP]+)(\d\d\d\d))?(?:(FT)/?)?([UND])?$]) { } 0 0 0
elsif (() = $t =~ /^(\342\210\222|-|\+|VC)?((?:SH)?\S{0,4})$/) { } 0 0 0
elsif (() = $t =~ m[^(FEW|SCT|BKN|OVC|SKC|CLR|VV|///)(\d\d\d|///)(CB|TCU)?$]) { } 0 0 0
elsif (() = $t =~ m[^(M)?(\d\d)/(M)?(\d\d)?$]) { } 0 0 0
Condition0%0/3
$t eq "TEMPO" or $t eq "BECMG"
l!l&&r!l&&!r
000
MC/DC0%0/2
$t eq "TEMPO" or $t eq "BECMG"
$t eq "TEMPO" $t eq "BECMG"
Truth table0%0/3
A or B
A= $t eq "TEMPO"B= $t eq "BECMG"
ABresult
1X1
011
000
294 0 ▶ push @section, $self->_section('CEIL', $ceiling) if ($ceiling < 100000);
Branch: 1 branch
BranchTrueFalseTotal
if $ceiling < 100000 0 0 0
295 0 $ceiling = 100000;
296 # Next token should be a time if it is a TAF
297 0 my ($from_day, $from_hour, $to_day, $to_hour);
298 0 ▶ if (@tok && (($from_day, $from_hour, $to_day, $to_hour) = $tok[0] =~ /^(\d\d)(\d\d)\/(\d\d)(\d\d)$/)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@tok and () = $tok[0] =~ m[^(\d\d)(\d\d)/(\d\d)(\d\d)$]) 0 0 0
Condition0%0/3
@tok and () = $tok[0] =~ m[^(\d\d)(\d\d)/(\d\d)(\d\d)$]
!ll&&!rl&&r
000
MC/DC0%0/2
@tok and () = $tok[0] =~ m[^(\d\d)(\d\d)/(\d\d)(\d\d)$]
@tok () = $tok[0] =~ m[^(\d\d)(\d\d)/(\d\d)(\d\d)$]
Truth table0%0/3
A and B
A= @tokB= () = $tok[0] =~ m[^(\d\d)(\d\d)/(\d\d)(\d\d)$]
ABresult
0X0
100
111
299 0 ▶ if ($self->{taf} && $from_hour >= 0 && $from_hour <= 24 && $to_hour >= 0 && $to_hour <= 24) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'taf'} and $from_hour >= 0 and $from_hour <= 24 and $to_hour >= 0 and $to_hour <= 24) { } 0 0 0
Condition0%0/12
$self->{"taf"} and $from_hour >= 0 and $from_hour <= 24 and $to_hour >= 0 and $to_hour <= 24
!ll&&!rl&&r
000
$self->{"taf"} and $from_hour >= 0 and $from_hour <= 24 and $to_hour >= 0
!ll&&!rl&&r
000
$self->{"taf"} and $from_hour >= 0 and $from_hour <= 24
!ll&&!rl&&r
000
$self->{"taf"} and $from_hour >= 0
!ll&&!rl&&r
000
MC/DC0%0/5
$self->{"taf"} and $from_hour >= 0 and $from_hour <= 24 and $to_hour >= 0 and $to_hour <= 24
$self->{"taf"} $from_hour >= 0 $from_hour <= 24 $to_hour >= 0 $to_hour <= 24
Truth table0%0/6
A and B and C and D and E
A= $self->{"taf"}B= $from_hour >= 0C= $from_hour <= 24D= $to_hour >= 0E= $to_hour <= 24
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
300 0 shift @tok;
301 0 $from_hour = _time($from_hour * 100);
302 0 $to_hour = _time($to_hour * 100);
303 } else {
304 0 undef $from_day;
305 0 undef $from_hour;
306 0 undef $from_day;
307 0 undef $to_hour;
308 }
309 }
310 0 push @section, $self->_section($t, $from_day, $from_hour, $to_day, $to_hour);
311  
312 # Ignore
313 } elsif ($ignore{$t}) {
314 ;
315
316 # No significant weather
317 ▶ } elsif ($t eq 'NOSIG' || $t eq 'NSW') {
Condition0%0/3
$t eq "NOSIG" or $t eq "NSW"
l!l&&r!l&&!r
000
MC/DC0%0/2
$t eq "NOSIG" or $t eq "NSW"
$t eq "NOSIG" $t eq "NSW"
Truth table0%0/3
A or B
A= $t eq "NOSIG"B= $t eq "NSW"
ABresult
1X1
011
000
318 0 push @section, $self->_section('WEATHER', 'NOSIG');
319  
320 # Specify broken on its own
321 } elsif ($t eq 'BKN') {
322 0 push @section, $self->_section('WEATHER', $t);
323
324 # Other 3 letter codes
325 } elsif ($clt{$t}) {
326 0 push @section, $self->_section('CLOUD', $t);
327
328 # EU CAVOK visibility > 10000m, no cloud, no significant weather
329 } elsif ($t eq 'CAVOK') {
330 0 ▶ $self->{visibility_dist} ||= ">10000";
Condition0%0/2
$self->{"visibility_dist"} ||= ">10000"
l!l
00
MC/DC0%0/1
$self->{"visibility_dist"} ||= ">10000"
$self->{"visibility_dist"}
Truth table0%0/2
A
A= $self->{"visibility_dist"}
Aresult
11
00
331 0 ▶ $self->{visibility_units} ||= 'm';
Condition0%0/2
$self->{"visibility_units"} ||= "m"
l!l
00
MC/DC0%0/1
$self->{"visibility_units"} ||= "m"
$self->{"visibility_units"}
Truth table0%0/2
A
A= $self->{"visibility_units"}
Aresult
11
00
332 0 push @section, $self->_section('CLOUD', 'CAVOK');
333  
334 # RMK group (Display ceiling, if one exists, and end)
335 } elsif ($t eq 'RMK') {
336 0 ▶ push @section, $self->_section('CEIL', $ceiling) if ($ceiling < 100000);
Branch: 1 branch
BranchTrueFalseTotal
if $ceiling < 100000 0 0 0
337 0 last;
338  
339 # From
340 } elsif (my ($fromDay, $fromTime) = $t =~ /^FM(\d{2})(\d{4})$/ ) {
341 0 ▶ push @section, $self->_section('CEIL', $ceiling) if ($ceiling < 100000);
Branch: 1 branch
BranchTrueFalseTotal
if $ceiling < 100000 0 0 0
342 0 $ceiling = 100000;
343 0 push @section, $self->_section('FROM', "$fromDay-" . _time($fromTime));
344  
345 # Until
346 } elsif (my ($tilDay, $tilTime) = $t =~ /^TL(\d{2})(\d{4})$/ ) {
347 0 ▶ push @section, $self->_section('CEIL', $ceiling) if ($ceiling < 100000);
Branch: 1 branch
BranchTrueFalseTotal
if $ceiling < 100000 0 0 0
348 0 $ceiling = 100000;
349 0 push @section, $self->_section('TIL', "$tilDay-" . _time($tilTime));
350  
351 # Probability
352 } elsif (my ($percent) = $t =~ /^PROB(\d\d)$/ ) {
353 0 ▶ push @section, $self->_section('CEIL', $ceiling) if ($ceiling < 100000);
Branch: 1 branch
BranchTrueFalseTotal
if $ceiling < 100000 0 0 0
354 0 $ceiling = 100000;
355 # Next token may be a time if it is a TAF
356 0 my ($from_day, $from_hour, $to_day, $to_hour);
357 0 ▶ if (@tok && (($from_day, $from_hour, $to_day, $to_hour) = $tok[0] =~ /^(\d\d)(\d\d)\/(\d\d)(\d\d)$/)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@tok and () = $tok[0] =~ m[^(\d\d)(\d\d)/(\d\d)(\d\d)$]) 0 0 0
Condition0%0/3
@tok and () = $tok[0] =~ m[^(\d\d)(\d\d)/(\d\d)(\d\d)$]
!ll&&!rl&&r
000
MC/DC0%0/2
@tok and () = $tok[0] =~ m[^(\d\d)(\d\d)/(\d\d)(\d\d)$]
@tok () = $tok[0] =~ m[^(\d\d)(\d\d)/(\d\d)(\d\d)$]
Truth table0%0/3
A and B
A= @tokB= () = $tok[0] =~ m[^(\d\d)(\d\d)/(\d\d)(\d\d)$]
ABresult
0X0
100
111
358 0 ▶ if ($self->{taf} && $from_hour >= 0 && $from_hour <= 24 && $to_hour >= 0 && $to_hour <= 24) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'taf'} and $from_hour >= 0 and $from_hour <= 24 and $to_hour >= 0 and $to_hour <= 24) { } 0 0 0
Condition0%0/12
$self->{"taf"} and $from_hour >= 0 and $from_hour <= 24 and $to_hour >= 0 and $to_hour <= 24
!ll&&!rl&&r
000
$self->{"taf"} and $from_hour >= 0 and $from_hour <= 24 and $to_hour >= 0
!ll&&!rl&&r
000
$self->{"taf"} and $from_hour >= 0 and $from_hour <= 24
!ll&&!rl&&r
000
$self->{"taf"} and $from_hour >= 0
!ll&&!rl&&r
000
MC/DC0%0/5
$self->{"taf"} and $from_hour >= 0 and $from_hour <= 24 and $to_hour >= 0 and $to_hour <= 24
$self->{"taf"} $from_hour >= 0 $from_hour <= 24 $to_hour >= 0 $to_hour <= 24
Truth table0%0/6
A and B and C and D and E
A= $self->{"taf"}B= $from_hour >= 0C= $from_hour <= 24D= $to_hour >= 0E= $to_hour <= 24
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
359 0 shift @tok;
360 0 $from_hour = _time($from_hour * 100);
361 0 $to_hour = _time($to_hour * 100);
362 } else {
363 0 undef $from_day;
364 0 undef $from_hour;
365 0 undef $from_day;
366 0 undef $to_hour;
367 }
368 }
369 0 push @section, $self->_section('PROB', $percent, $from_day, $from_hour, $to_day, $to_hour);
370  
371 # Runway
372 } elsif (my ($sort, $dir) = $t =~ /^(RWY?|LDG)(\d\d[RLC]?)$/ ) {
373 0 push @section, $self->_section('RWY', $sort, $dir);
374  
375 # Wind
376 } elsif (my ($wdir, $spd, $gust, $unit) = $t =~ /^(\d\d\d|VRB)(\d\d)(?:G(\d\d))?(KT|MPH|MPS|KMH)$/) {
377
378 0 my ($fromdir, $todir);
379
380 0 ▶ if (@tok && (($fromdir, $todir) = $tok[0] =~ /^(\d\d\d)V(\d\d\d)$/)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@tok and () = $tok[0] =~ /^(\d\d\d)V(\d\d\d)$/) 0 0 0
Condition0%0/3
@tok and () = $tok[0] =~ /^(\d\d\d)V(\d\d\d)$/
!ll&&!rl&&r
000
MC/DC0%0/2
@tok and () = $tok[0] =~ /^(\d\d\d)V(\d\d\d)$/
@tok () = $tok[0] =~ /^(\d\d\d)V(\d\d\d)$/
Truth table0%0/3
A and B
A= @tokB= () = $tok[0] =~ /^(\d\d\d)V(\d\d\d)$/
ABresult
0X0
100
111
381 0 shift @tok;
382 }
383
384 # It could be variable so look at the next token
385  
386 0 $spd = 0 + $spd;
387 0 ▶ $gust = 0 + $gust if defined $gust;
Branch: 1 branch
BranchTrueFalseTotal
if defined $gust 0 0 0
388 0 $unit = ucfirst lc $unit;
389 0 ▶ $unit = 'm/sec' if $unit eq 'Mps';
Branch: 1 branch
BranchTrueFalseTotal
if $unit eq "Mps" 0 0 0
390 0 ▶ $unit = 'knots' if $unit eq 'Kt';
Branch: 1 branch
BranchTrueFalseTotal
if $unit eq "Kt" 0 0 0
391 0 ▶ $self->{wind_dir} ||= $wdir;
Condition0%0/3
$self->{"wind_dir"} ||= $wdir
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"wind_dir"} ||= $wdir
$self->{"wind_dir"} $wdir
Truth table0%0/3
A ||= B
A= $self->{"wind_dir"}B= $wdir
ABresult
1X1
011
000
392 0 ▶ $self->{wind_speed} ||= $spd;
Condition0%0/3
$self->{"wind_speed"} ||= $spd
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"wind_speed"} ||= $spd
$self->{"wind_speed"} $spd
Truth table0%0/3
A ||= B
A= $self->{"wind_speed"}B= $spd
ABresult
1X1
011
000
393 0 ▶ $self->{wind_gusting} ||= $gust;
Condition0%0/3
$self->{"wind_gusting"} ||= $gust
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"wind_gusting"} ||= $gust
$self->{"wind_gusting"} $gust
Truth table0%0/3
A ||= B
A= $self->{"wind_gusting"}B= $gust
ABresult
1X1
011
000
394 0 ▶ $self->{wind_units} ||= $unit;
Condition0%0/3
$self->{"wind_units"} ||= $unit
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"wind_units"} ||= $unit
$self->{"wind_units"} $unit
Truth table0%0/3
A ||= B
A= $self->{"wind_units"}B= $unit
ABresult
1X1
011
000
395 0 push @section, $self->_section('WIND', $wdir, $spd, $gust, $unit, $fromdir, $todir);
396
397 # Altimeter setting
398 } elsif (my ($u, $p, $punit) = $t =~ /^([QA])(?:NH)?(\d\d\d\d)(INS?)?$/) {
399  
400 0 $p = 0 + $p;
401 0 ▶ if ($u eq 'A' || $punit && $punit =~ /^I/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($u eq 'A' or $punit and $punit =~ /^I/) { } 0 0 0
Condition0%0/6
$u eq "A" or $punit and $punit =~ /^I/
l!l&&r!l&&!r
000
$punit and $punit =~ /^I/
!ll&&!rl&&r
000
MC/DC0%0/3
$u eq "A" or $punit and $punit =~ /^I/
$u eq "A" $punit $punit =~ /^I/
Truth table0%0/4
A or B and C
A= $u eq "A"B= $punitC= $punit =~ /^I/
ABCresult
1XX1
0111
00X0
0100
402 0 $p = sprintf "%.2f", $p / 100;
403 0 $u = 'inHg';
404 } else {
405 0 $u = 'hPa';
406 }
407 0 ▶ $self->{pressure} ||= $p;
Condition0%0/3
$self->{"pressure"} ||= $p
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"pressure"} ||= $p
$self->{"pressure"} $p
Truth table0%0/3
A ||= B
A= $self->{"pressure"}B= $p
ABresult
1X1
011
000
408 0 ▶ $self->{pressure_units} ||= $u;
Condition0%0/3
$self->{"pressure_units"} ||= $u
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"pressure_units"} ||= $u
$self->{"pressure_units"} $u
Truth table0%0/3
A ||= B
A= $self->{"pressure_units"}B= $u
ABresult
1X1
011
000
409 0 push @section, $self->_section('PRESS', $p, $u);
410  
411 # Current (METAR) wind shear
412 } elsif ($t eq 'WS') {
413 0 my $runway = '';
414 0 ▶ if ($tok[0] eq 'ALL' && $tok[1] eq 'RWY') {
Branch: 2 branches
BranchTrueFalseTotal
if ($tok[0] eq 'ALL' and $tok[1] eq 'RWY') { } 0 0 0
elsif ($tok[0] eq 'RWY' and $tok[1] =~ /\d\d[LRC]?/) { } 0 0 0
Condition0%0/3
$tok[0] eq "ALL" and $tok[1] eq "RWY"
!ll&&!rl&&r
000
MC/DC0%0/2
$tok[0] eq "ALL" and $tok[1] eq "RWY"
$tok[0] eq "ALL" $tok[1] eq "RWY"
Truth table0%0/3
A and B
A= $tok[0] eq "ALL"B= $tok[1] eq "RWY"
ABresult
0X0
100
111
415 0 $runway = 'all runways';
416 0 shift @tok; shift @tok;
417 }
418 ▶ elsif ($tok[0] eq 'RWY' && $tok[1] =~ /\d\d[LRC]?/) {
Condition0%0/3
$tok[0] eq "RWY" and $tok[1] =~ /\d\d[LRC]?/
!ll&&!rl&&r
000
MC/DC0%0/2
$tok[0] eq "RWY" and $tok[1] =~ /\d\d[LRC]?/
$tok[0] eq "RWY" $tok[1] =~ /\d\d[LRC]?/
Truth table0%0/3
A and B
A= $tok[0] eq "RWY"B= $tok[1] =~ /\d\d[LRC]?/
ABresult
0X0
100
111
419 0 $runway = "Runway $tok[1]";
420 0 shift @tok; shift @tok;
421 }
422 0 push @section, $self->_section('CURRENTSHEAR', $runway);
423  
424 # Forecast (TAF) wind shear
425 } elsif (my ($top, $direction, $speed) = $t =~ m!^WS(\d{3})\/(\d{3})(\d+)KT$!) {
426 0 push @section, $self->_section('FORECASTSHEAR', $top * 100, $direction, $speed);
427  
428 # Visibility group in metres
429 } elsif (my ($visibility, $mist) = $t =~ m!^(\d\d\d\d[NSEW]{0,2})([A-Z][A-Z])?$!) {
430 0 ▶ $visibility = $visibility eq '9999' ? ">10000" : 0 + $visibility;
Branch: 1 branch
BranchTrueFalseTotal
$visibility eq '9999' ? : 0 0 0
431 0 ▶ $self->{visibility_dist} ||= $visibility;
Condition0%0/3
$self->{"visibility_dist"} ||= $visibility
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"visibility_dist"} ||= $visibility
$self->{"visibility_dist"} $visibility
Truth table0%0/3
A ||= B
A= $self->{"visibility_dist"}B= $visibility
ABresult
1X1
011
000
432 0 ▶ $self->{visibility_units} ||= 'metres';
Condition0%0/2
$self->{"visibility_units"} ||= "metres"
l!l
00
MC/DC0%0/1
$self->{"visibility_units"} ||= "metres"
$self->{"visibility_units"}
Truth table0%0/2
A
A= $self->{"visibility_units"}
Aresult
11
00
433 0 push @section, $self->_section('VISIBILITY', $visibility, 'm');
434 0 ▶ push @section, $self->_section('WEATHER', $mist) if $mist;
Branch: 1 branch
BranchTrueFalseTotal
if $mist 0 0 0
435  
436 # Visibility group in kilometres
437 } elsif (($visibility) = $t =~ m!^(\d+)KM$!) {
438 0 ▶ $visibility = $visibility eq '9999' ? ">10000" : 0 + $visibility;
Branch: 1 branch
BranchTrueFalseTotal
$visibility eq '9999' ? : 0 0 0
439 0 ▶ $self->{visibility_dist} ||= $visibility;
Condition0%0/3
$self->{"visibility_dist"} ||= $visibility
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"visibility_dist"} ||= $visibility
$self->{"visibility_dist"} $visibility
Truth table0%0/3
A ||= B
A= $self->{"visibility_dist"}B= $visibility
ABresult
1X1
011
000
440 0 ▶ $self->{visibility_units} ||= 'kilometres';
Condition0%0/2
$self->{"visibility_units"} ||= "kilometres"
l!l
00
MC/DC0%0/1
$self->{"visibility_units"} ||= "kilometres"
$self->{"visibility_units"}
Truth table0%0/2
A
A= $self->{"visibility_units"}
Aresult
11
00
441 0 push @section, $self->_section('VISIBILITY', $visibility, 'Km');
442  
443 # Visibility group in miles and fraction of a mile with space between them
444 } elsif (my ($m) = $t =~ m!^(\d)$!) {
445 0 my $visibility;
446 0 ▶ if (@tok && (($visibility) = $tok[0] =~ m!^(\d/\d)SM$!)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@tok and ($visibility) = $tok[0] =~ m[^(\d/\d)SM$]) 0 0 0
Condition0%0/3
@tok and ($visibility) = $tok[0] =~ m[^(\d/\d)SM$]
!ll&&!rl&&r
000
MC/DC0%0/2
@tok and ($visibility) = $tok[0] =~ m[^(\d/\d)SM$]
@tok ($visibility) = $tok[0] =~ m[^(\d/\d)SM$]
Truth table0%0/3
A and B
A= @tokB= ($visibility) = $tok[0] =~ m[^(\d/\d)SM$]
ABresult
0X0
100
111
447 0 shift @tok;
448 0 $visibility = "$m $visibility";
449 0 ▶ $self->{visibility_dist} ||= $visibility;
Condition0%0/3
$self->{"visibility_dist"} ||= $visibility
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"visibility_dist"} ||= $visibility
$self->{"visibility_dist"} $visibility
Truth table0%0/3
A ||= B
A= $self->{"visibility_dist"}B= $visibility
ABresult
1X1
011
000
450 0 ▶ $self->{visibility_units} ||= 'Statute Miles';
Condition0%0/2
$self->{"visibility_units"} ||= "Statute Miles"
l!l
00
MC/DC0%0/1
$self->{"visibility_units"} ||= "Statute Miles"
$self->{"visibility_units"}
Truth table0%0/2
A
A= $self->{"visibility_units"}
Aresult
11
00
451 0 push @section, $self->_section('VISIBILITY', $visibility, 'miles');
452 }
453
454 # Visibility group in miles (either in miles or under a mile)
455 } elsif (my ($lt, $mvisibility) = $t =~ m!^([MP])?(\d+(:?/\d)?)SM$!) {
456 0 ▶ $mvisibility = 'Less than ' . $mvisibility if (defined($lt) && $lt eq 'M');
Branch: 1 branch
BranchTrueFalseTotal
if defined $lt and $lt eq "M" 0 0 0
Condition0%0/3
defined $lt and $lt eq "M"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $lt and $lt eq "M"
defined $lt $lt eq "M"
Truth table0%0/3
A and B
A= defined $ltB= $lt eq "M"
ABresult
0X0
100
111
457 0 ▶ $mvisibility = 'Greater than ' . $mvisibility if (defined($lt) && $lt eq 'P');
Branch: 1 branch
BranchTrueFalseTotal
if defined $lt and $lt eq "P" 0 0 0
Condition0%0/3
defined $lt and $lt eq "P"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $lt and $lt eq "P"
defined $lt $lt eq "P"
Truth table0%0/3
A and B
A= defined $ltB= $lt eq "P"
ABresult
0X0
100
111
458 0 ▶ $self->{visibility_dist} ||= $mvisibility;
Condition0%0/3
$self->{"visibility_dist"} ||= $mvisibility
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"visibility_dist"} ||= $mvisibility
$self->{"visibility_dist"} $mvisibility
Truth table0%0/3
A ||= B
A= $self->{"visibility_dist"}B= $mvisibility
ABresult
1X1
011
000
459 0 ▶ $self->{visibility_units} ||= 'Statute Miles';
Condition0%0/2
$self->{"visibility_units"} ||= "Statute Miles"
l!l
00
MC/DC0%0/1
$self->{"visibility_units"} ||= "Statute Miles"
$self->{"visibility_units"}
Truth table0%0/2
A
A= $self->{"visibility_units"}
Aresult
11
00
460 0 my $units = 'miles';
461 0 ▶ $units = 'mile' if ($mvisibility =~ /M|\// || $mvisibility =~ /^1$/);
Branch: 1 branch
BranchTrueFalseTotal
if $mvisibility =~ m[M|/] or $mvisibility =~ /^1$/ 0 0 0
Condition0%0/3
$mvisibility =~ m[M|/] or $mvisibility =~ /^1$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$mvisibility =~ m[M|/] or $mvisibility =~ /^1$/
$mvisibility =~ m[M|/] $mvisibility =~ /^1$/
Truth table0%0/3
A or B
A= $mvisibility =~ m[M|/]B= $mvisibility =~ /^1$/
ABresult
1X1
011
000
462 0 push @section, $self->_section('VISIBILITY', $mvisibility, $units);
463
464 # Runway Visual Range
465 } elsif (my ($rw, $rlt, $range, $vlt, $var, $runit, $tend) = $t =~ m!^R(\d\d[LRC]?)/([MP])?(\d\d\d\d)(?:([VMP]+)(\d\d\d\d))?(?:(FT)/?)?([UND])?$!) {
466 0 ▶ $runit = 'm' unless $runit;
Branch: 1 branch
BranchTrueFalseTotal
unless $runit 0 0 0
467 0 $runit = lc $runit;
468 0 ▶ $runit = 'feet' if $runit eq 'ft';
Branch: 1 branch
BranchTrueFalseTotal
if $runit eq "ft" 0 0 0
469 0 ▶ $range = "<$range" if $rlt && $rlt eq 'M';
Branch: 1 branch
BranchTrueFalseTotal
if $rlt and $rlt eq "M" 0 0 0
Condition0%0/3
$rlt and $rlt eq "M"
!ll&&!rl&&r
000
MC/DC0%0/2
$rlt and $rlt eq "M"
$rlt $rlt eq "M"
Truth table0%0/3
A and B
A= $rltB= $rlt eq "M"
ABresult
0X0
100
111
470 0 ▶ $range = ">$range" if $rlt && $rlt eq 'P';
Branch: 1 branch
BranchTrueFalseTotal
if $rlt and $rlt eq "P" 0 0 0
Condition0%0/3
$rlt and $rlt eq "P"
!ll&&!rl&&r
000
MC/DC0%0/2
$rlt and $rlt eq "P"
$rlt $rlt eq "P"
Truth table0%0/3
A and B
A= $rltB= $rlt eq "P"
ABresult
0X0
100
111
471 0 ▶ $var = "<$var" if $vlt && $vlt =~ /M/;
Branch: 1 branch
BranchTrueFalseTotal
if $vlt and $vlt =~ /M/ 0 0 0
Condition0%0/3
$vlt and $vlt =~ /M/
!ll&&!rl&&r
000
MC/DC0%0/2
$vlt and $vlt =~ /M/
$vlt $vlt =~ /M/
Truth table0%0/3
A and B
A= $vltB= $vlt =~ /M/
ABresult
0X0
100
111
472 0 ▶ $var = ">$var" if $vlt && $vlt =~ /P/;
Branch: 1 branch
BranchTrueFalseTotal
if $vlt and $vlt =~ /P/ 0 0 0
Condition0%0/3
$vlt and $vlt =~ /P/
!ll&&!rl&&r
000
MC/DC0%0/2
$vlt and $vlt =~ /P/
$vlt $vlt =~ /P/
Truth table0%0/3
A and B
A= $vltB= $vlt =~ /P/
ABresult
0X0
100
111
473 0 push @section, $self->_section('RVR', $rw, $range, $var, $runit, $tend);
474
475 # Weather
476 # The symbol used for "light" descriptor appears to vary; included both a
477 # hyphen and an en dash.
478 } elsif (my ($deg, $w) = $t =~ /^(−|-|\+|VC)?((?:SH)?\S{0,4})$/) {
479 # Replace +FC (tornado) with module specific 'ZZ' code
480 0 ▶ if (defined($deg) && "$deg$w" eq '+FC') {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $deg and "$deg$w" eq '+FC') { } 0 0 0
elsif ($w eq '+FC') { } 0 0 0
Condition0%0/3
defined $deg and "$deg$w" eq "+FC"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $deg and "$deg$w" eq "+FC"
defined $deg "$deg$w" eq "+FC"
Truth table0%0/3
A and B
A= defined $degB= "$deg$w" eq "+FC"
ABresult
0X0
100
111
481 0 $deg = '';
482 0 $w = 'ZZ';
483 } elsif ($w eq '+FC') {
484 0 $w = 'ZZ';
485 }
486 # Differentiate between VC in TAF and METAR/SPECI; use VT for TAF
487 0 ▶ $deg = 'VT' if (defined($deg) && $deg eq 'VC' && $self->{taf});
Branch: 1 branch
BranchTrueFalseTotal
if defined $deg and $deg eq "VC" and $self->{"taf"} 0 0 0
Condition0%0/6
defined $deg and $deg eq "VC" and $self->{"taf"}
!ll&&!rl&&r
000
defined $deg and $deg eq "VC"
!ll&&!rl&&r
000
MC/DC0%0/3
defined $deg and $deg eq "VC" and $self->{"taf"}
defined $deg $deg eq "VC" $self->{"taf"}
Truth table0%0/4
A and B and C
A= defined $degB= $deg eq "VC"C= $self->{"taf"}
ABCresult
0XX0
10X0
1100
1111
488  
489 0 push @section, $self->_section('WEATHER', $deg, $w =~ /([A-Z][A-Z])/g);
490  
491 # Sky conditions
492 } elsif (my ($amt, $height, $cb) = $t =~ m!^(FEW|SCT|BKN|OVC|SKC|CLR|VV|///)(\d\d\d|///)(CB|TCU)?$!) {
493 0 ▶ push @section, $self->_section('CLOUD', $amt, $height eq '///' ? 0 : $height * 100, $cb) unless $amt eq '///' && $height eq '///';
Branch: 2 branches
BranchTrueFalseTotal
unless $amt eq "///" and $height eq "///" 0 0 0
$height eq '///' ? : 0 0 0
Condition0%0/3
$amt eq "///" and $height eq "///"
!ll&&!rl&&r
000
MC/DC0%0/2
$amt eq "///" and $height eq "///"
$amt eq "///" $height eq "///"
Truth table0%0/3
A and B
A= $amt eq "///"B= $height eq "///"
ABresult
0X0
100
111
494 0 ▶ if ($amt =~ /BKN|OVC|VV/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($amt =~ /BKN|OVC|VV/) 0 0 0
495 0 ▶ $ceiling = $height * 100 if ($height * 100 < $ceiling);
Branch: 1 branch
BranchTrueFalseTotal
if $height * 100 < $ceiling 0 0 0
496 }
497  
498 # Temperature / Dew Point (only appears in METAR/SPECI)
499 } elsif (my ($ms, $t, $n, $d) = $t =~ m/^(M)?(\d\d)\/(M)?(\d\d)?$/) {
500 0 $t = 0 + $t;
501 0 $d = 0 + $d;
502 0 ▶ $t = -$t if defined $ms;
Branch: 1 branch
BranchTrueFalseTotal
if defined $ms 0 0 0
503 0 ▶ $d = -$d if defined $d && defined $n;
Branch: 1 branch
BranchTrueFalseTotal
if defined $d and defined $n 0 0 0
Condition0%0/3
defined $d and defined $n
!ll&&!rl&&r
000
MC/DC0%0/2
defined $d and defined $n
defined $d defined $n
Truth table0%0/3
A and B
A= defined $dB= defined $n
ABresult
0X0
100
111
504 0 ▶ $self->{temp} ||= $t;
Condition0%0/3
$self->{"temp"} ||= $t
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"temp"} ||= $t
$self->{"temp"} $t
Truth table0%0/3
A ||= B
A= $self->{"temp"}B= $t
ABresult
1X1
011
000
505 0 ▶ $self->{dewpoint} ||= $d;
Condition0%0/3
$self->{"dewpoint"} ||= $d
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"dewpoint"} ||= $d
$self->{"dewpoint"} $d
Truth table0%0/3
A ||= B
A= $self->{"dewpoint"}B= $d
ABresult
1X1
011
000
506 0 push @section, $self->_section('TEMP', $t);
507 0 push @section, $self->_section('DWPT', $d);
508 }
509
510 }
511 0 $self->{sections} = \@section;
512 0 $self->{error_code} = 0;
513 0 return undef;
514 }
515  
516 sub _section
517 0 ▶{
Subroutine _section: not called CC=1 SCAR=1.7
518 0 my $self = shift;
519 0 my $pkg = shift;
520 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
521 0 $pkg = $self->{decode_language} . '::' . $pkg;
522 0 return $pkg->new(@_);
523 }
524  
525 sub _time
526 0 ▶{
Subroutine _time: not called CC=1 SCAR=6.9
527 0 return sprintf "%02d:%02d", unpack "a2a2", sprintf "%04d", shift;
528 }
529  
530 # Accessors
531 sub AUTOLOAD
532 0 ▶{
Subroutine AUTOLOAD: not called CC=2 SCAR=12.2
533 1 ▶ no strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
534 0 my ($package, $name) = $AUTOLOAD =~ /^(.*)::(\w+)$/;
535 0 ▶ return if $name eq 'DESTROY';
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "DESTROY" 0 0 0
536  
537 0 ▶ *$AUTOLOAD = sub {return $_[0]->{$name}};
Subroutine __ANON__: not called CC=1 SCAR=6.9
538 0 goto &$AUTOLOAD;
539 }
540  
541 #
542 # These are the translation packages
543 #
544 # First the factory method
545 #
546  
547 package Geo::METARTAF::EN;
548  
549 sub new
550 0 ▶{
Subroutine new: not called CC=1 SCAR=6.9
551 0 my $pkg = shift;
552 0 return bless [@_], $pkg;
553 }
554  
555 sub as_string
556 0 ▶{
Subroutine as_string: not called CC=2 SCAR=17.9
557 0 my $self = shift;
558 0 my ($n) = (ref $self) =~ /::(\w+)$/;
559 0 ▶ return join ' ', ucfirst $n, map {defined $_ ? $_ : ()} @$self;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
560 }
561  
562 sub day
563 0 ▶{
Subroutine day: not called CC=9 SCAR=45.0
564 0 my $pkg = shift;
565 0 ▶ my $d = sprintf "%d", ref($pkg) ? shift : $pkg;
Branch: 1 branch
BranchTrueFalseTotal
ref $pkg ? : 0 0 0
566 0 ▶ if ($d == 1 || $d == 21 || $d == 31) {
Branch: 3 branches
BranchTrueFalseTotal
if ($d == 1 or $d == 21 or $d == 31) { } 0 0 0
elsif ($d == 2 or $d == 22) { } 0 0 0
elsif ($d == 3 or $d == 23) { } 0 0 0
Condition0%0/6
$d == 1 or $d == 21 or $d == 31
l!l&&r!l&&!r
000
$d == 1 or $d == 21
l!l&&r!l&&!r
000
MC/DC0%0/3
$d == 1 or $d == 21 or $d == 31
$d == 1 $d == 21 $d == 31
Truth table0%0/4
A or B or C
A= $d == 1B= $d == 21C= $d == 31
ABCresult
1XX1
01X1
0011
0000
567 0 return "${d}st";
568 ▶ } elsif ($d == 2 || $d == 22) {
Condition0%0/3
$d == 2 or $d == 22
l!l&&r!l&&!r
000
MC/DC0%0/2
$d == 2 or $d == 22
$d == 2 $d == 22
Truth table0%0/3
A or B
A= $d == 2B= $d == 22
ABresult
1X1
011
000
569 0 return "${d}nd";
570 ▶ } elsif ($d == 3 || $d == 23) {
Condition0%0/3
$d == 3 or $d == 23
l!l&&r!l&&!r
000
MC/DC0%0/2
$d == 3 or $d == 23
$d == 3 $d == 23
Truth table0%0/3
A or B
A= $d == 3B= $d == 23
ABresult
1X1
011
000
571 0 return "${d}rd";
572 }
573 0 return "${d}th";
574 }
575  
576 # Report header (type, location, issue time, and date)
577 package Geo::METARTAF::EN::HEAD;
578 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
579 1 @ISA = qw(Geo::METARTAF::EN);
580  
581 sub as_string
582 0 ▶{
Subroutine as_string: not called CC=1 SCAR=6.9
583 0 my $self = shift;
584 0 return "$self->[0] for $self->[1] issued at $self->[3] on the " . $self->day($self->[2]) . " $self->[4]\n";
585 }
586  
587 # TAF valid period
588 package Geo::METARTAF::EN::VALID;
589 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
590 1 @ISA = qw(Geo::METARTAF::EN);
591  
592 sub as_string
593 0 ▶{
Subroutine as_string: not called CC=2 SCAR=17.9
594 0 my $self = shift;
595 0 my $out = "Valid from $self->[1]";
596 # If the day is the same for both times
597 0 ▶ if ($self->[0] == $self->[2]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->[0] == $self->[2]) { } 0 0 0
598 0 $out .= " to $self->[3] on the " . $self->day($self->[0]);
599 }
600 else {
601 0 $out .= " on the " . $self->day($self->[0]) . " to $self->[3] on the " . $self->day($self->[2]);
602 }
603 0 return $out;
604 }
605  
606 # Wind Info: direction, $speed, $gusts, $unit, $fromdir, $todir
607 package Geo::METARTAF::EN::WIND;
608 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
609 1 @ISA = qw(Geo::METARTAF::EN);
610  
611 sub as_string
612 0 ▶{
Subroutine as_string: not called CC=8 SCAR=42.8
613 0 my $self = shift;
614 0 my $out = "~Wind Conditions: ";
615 0 ▶ if ($self->[0] ne 'VRB' && $self->[0] == 0 && $self->[1] == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->[0] ne 'VRB' and $self->[0] == 0 and $self->[1] == 0) { } 0 0 0
Condition0%0/6
$self->[0] ne "VRB" and $self->[0] == 0 and $self->[1] == 0
!ll&&!rl&&r
000
$self->[0] ne "VRB" and $self->[0] == 0
!ll&&!rl&&r
000
MC/DC0%0/3
$self->[0] ne "VRB" and $self->[0] == 0 and $self->[1] == 0
$self->[0] ne "VRB" $self->[0] == 0 $self->[1] == 0
Truth table0%0/4
A and B and C
A= $self->[0] ne "VRB"B= $self->[0] == 0C= $self->[1] == 0
ABCresult
0XX0
10X0
1100
1111
616 0 $out .= 'Calm';
617 }
618 else {
619 0 ▶ $out .= $self->[0] eq 'VRB' ? "Variable" : "$self->[0]";
Branch: 1 branch
BranchTrueFalseTotal
$self->[0] eq 'VRB' ? : 0 0 0
620 0 ▶ $out .= "°T varying between $self->[4]°T and $self->[5]" if defined $self->[4];
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->[4] 0 0 0
621 0 ▶ $out .= ($self->[0] eq 'VRB' ? '' : "°T") . " at $self->[1] $self->[3]";
Branch: 1 branch
BranchTrueFalseTotal
$self->[0] eq 'VRB' ? : 0 0 0
622 0 ▶ $out .= " gusting to $self->[2] $self->[3]" if defined $self->[2];
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->[2] 0 0 0
623 }
624 0 return $out;
625 }
626  
627 # Altimeter setting
628 package Geo::METARTAF::EN::PRESS;
629 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
630 1 @ISA = qw(Geo::METARTAF::EN);
631  
632 sub as_string
633 0 ▶{
Subroutine as_string: not called CC=1 SCAR=6.9
634 0 my $self = shift;
635 0 return "~Altimeter Setting: $self->[0] $self->[1]";
636 }
637  
638 # Low-level wind shear in METAR
639 package Geo::METARTAF::EN::CURRENTSHEAR;
640 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
641 1 @ISA = qw(Geo::METARTAF::EN);
642  
643 sub as_string
644 0 ▶{
Subroutine as_string: not called CC=1 SCAR=6.9
645 0 my $self = shift;
646 0 return "~Low-Level Wind Shear: Within 1500 feet AGL along the take-off or approach path of $self->[0]";
647 }
648  
649 # Low-level wind shear in TAF
650 package Geo::METARTAF::EN::FORECASTSHEAR;
651 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
652 1 @ISA = qw(Geo::METARTAF::EN);
653  
654 sub as_string
655 0 ▶{
Subroutine as_string: not called CC=1 SCAR=6.9
656 0 my $self = shift;
657 0 return "~Low-Level Wind Shear: $self->[1]°T at $self->[2] knots with top layer at $self->[0] feet AGL";
658 }
659  
660 # Temperature
661 package Geo::METARTAF::EN::TEMP;
662 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
663 1 @ISA = qw(Geo::METARTAF::EN);
664  
665 sub as_string
666 0 ▶{
Subroutine as_string: not called CC=1 SCAR=6.9
667 0 my $self = shift;
668 0 my $out = "~Temperature: $self->[0]°C";
669 0 return $out;
670 }
671  
672 # Dew Point
673 package Geo::METARTAF::EN::DWPT;
674 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
675 1 @ISA = qw(Geo::METARTAF::EN);
676  
677 sub as_string
678 0 ▶{
Subroutine as_string: not called CC=1 SCAR=6.9
679 0 my $self = shift;
680 0 my $out = "~Dew Point: $self->[0]°C";
681 0 return $out;
682 }
683  
684 # Cloud coverage
685 package Geo::METARTAF::EN::CLOUD;
686 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
687 1 @ISA = qw(Geo::METARTAF::EN);
688  
689 1 my %st = (
690 VV => "Obscured at",
691 SKC => "Clear - No cloud",
692 CLR => "Clear - No cloud and no significant weather",
693 SCT => "Scattered clouds (3-4 oktas) at",
694 BKN => "Broken clouds (5-7 oktas) at",
695 FEW => "Few clouds (0-2 oktas) at",
696 OVC => "Overcast clouds (8 oktas) at",
697 CAVOK => "No cloud below 5000 feet, >= 10 km visibility, and no significant weather (CAVOK)",
698 CB => "Cumulonimbus clouds present",
699 TCU => "Towering Cumulus clouds present",
700 NSC => "No significant cloud",
701 BLU => "3 oktas at 2500ft 8Km visibility",
702 WHT => "3 oktas at 1500ft 5Km visibility",
703 GRN => "3 oktas at 700ft 3700m visibility",
704 YLO => "3 oktas at 300ft 1600m visibility",
705 AMB => "3 oktas at 200ft 800m visibility",
706 RED => "3 oktas at <200ft <800m visibility",
707 NIL => "No weather",
708 '///' => "some",
709 );
710  
711 sub as_string
712 0 ▶{
Subroutine as_string: not called CC=4 SCAR=30.0
713 0 my $self = shift;
714 0 ▶ return "~Sky Conditions: " . $st{$self->[0]} if @$self == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @$self == 1 0 0 0
715 0 ▶ return "~Sky Conditions: " . $st{$self->[0]} . " $self->[1] feet AGL" if $self->[0] eq 'VV';
Branch: 1 branch
BranchTrueFalseTotal
if $self->[0] eq "VV" 0 0 0
716 0 ▶ return "~Sky Conditions: " . $st{$self->[0]} . " $self->[1] feet AGL" . ((defined $self->[2]) ? " with $st{$self->[2]}" : "");
Branch: 1 branch
BranchTrueFalseTotal
defined $self->[2] ? : 0 0 0
717 }
718  
719 # Local ceiling
720 package Geo::METARTAF::EN::CEIL;
721 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
722 1 @ISA = qw(Geo::METARTAF::EN);
723  
724 sub as_string
725 0 ▶{
Subroutine as_string: not called CC=1 SCAR=6.9
726 0 my $self = shift;
727 0 my $out = "~Ceiling: $self->[0] feet AGL";
728 0 return $out;
729 }
730  
731 # Weather phenomena
732 package Geo::METARTAF::EN::WEATHER;
733 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
734 1 @ISA = qw(Geo::METARTAF::EN);
735  
736 1 my %wt = (
737 '+' => "Heavy",
738 '−' => "Light",
739 '-' => "Light",
740 'VC' => "within 5 SM of the aerodrome (but not at the aerodrome)",
741 'VT' => "within 5-10 NM of the aerodrome (but not at the aerodrome)",
742  
743 MI => "Shallow",
744 PR => "Partial",
745 BC => "Patches of",
746 DR => "Drifting",
747 BL => "Blowing",
748 SH => "Showers",
749 TS => "Thunderstorm",
750 FZ => "Freezing",
751 RE => "Recent",
752
753 DZ => "Drizzle",
754 RA => "Rain",
755 SN => "Snow",
756 SG => "Snow Grains",
757 IC => "Ice Crystals (Vis <= 6 SM)",
758 PL => "Ice Pellets",
759 GR => "Hail",
760 GS => "Snow Pellets",
761 UP => "Unknown precipitation",
762
763 BR => "Mist (Vis >= 5/8 SM)",
764 FG => "Fog (Vis < 5/8 SM)",
765 FU => "Smoke (Vis <= 6 SM)",
766 VA => "Volcanic Ash",
767 DU => "Dust (Vis <= 6 SM)",
768 SA => "Sand (Vis <= 6 SM)",
769 HZ => "Haze (Vis <= 6 SM)",
770 PY => "Spray",
771
772 PO => "Dust/Sand Whirls (Dust Devils)",
773 SQ => "Squalls",
774 FC => "Funnel Cloud",
775 SS => "Sandstorm (Vis < 5/8 SM)",
776 DS => "Dust Storm (Vis < 5/8 SM)",
777 WS => "Wind Shear",
778 ZZ => "Tornado or Waterspout", # Only for this module (actual code is '+FC')
779  
780 'BKN' => "Broken",
781 'NOSIG' => "No significant weather",
782 );
783  
784 sub as_string
785 0 ▶{
Subroutine as_string: not called CC=12 SCAR=50.5
786 0 my $self = shift;
787 0 my @out;
788 0 my $report_vic = '';
789  
790 0 my ($vic, $shower);
791 0 my @in;
792 0 push @in, @$self;
793
794 0 ▶ while (@in) {
Branch: 1 branch
BranchTrueFalseTotal
if (@in) 0 0 0
795 0 my $t = shift @in;
796  
797 0 ▶ if (!defined $t) {
Branch: 3 branches
BranchTrueFalseTotal
if (not defined $t) { } 0 0 0
elsif ($t eq 'VC' or $t eq 'VT') { } 0 0 0
elsif ($t eq 'SH') { } 0 0 0
798 0 next;
799 ▶ } elsif ($t eq 'VC' || $t eq 'VT') {
Condition0%0/3
$t eq "VC" or $t eq "VT"
l!l&&r!l&&!r
000
MC/DC0%0/2
$t eq "VC" or $t eq "VT"
$t eq "VC" $t eq "VT"
Truth table0%0/3
A or B
A= $t eq "VC"B= $t eq "VT"
ABresult
1X1
011
000
800 0 $report_vic = $t;
801 0 $vic++;
802 0 next;
803 } elsif ($t eq 'SH') {
804 0 ▶ if ($vic) {
Branch: 1 branch
BranchTrueFalseTotal
if ($vic) { } 0 0 0
805 0 push @out, $wt{'SH'};
806 } else {
807 0 $shower++;
808 }
809 0 next;
810 }
811
812 # Display singular of phenomena when associated with showers
813 # (e.g. - 'Ice Pellet Showers' instead of 'Ice Pellets Showers')
814 0 ▶ if ($shower && $wt{$t} =~ /s$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($shower and $wt{$t} =~ /s$/) { } 0 0 0
Condition0%0/3
$shower and $wt{$t} =~ /s$/
!ll&&!rl&&r
000
MC/DC0%0/2
$shower and $wt{$t} =~ /s$/
$shower $wt{$t} =~ /s$/
Truth table0%0/3
A and B
A= $showerB= $wt{$t} =~ /s$/
ABresult
0X0
100
111
815 0 push @out, substr($wt{$t}, 0, -1);
816 } else {
817 0 push @out, $wt{$t};
818 }
819  
820 }
821
822 0 ▶ if (@out && $shower) {
Branch: 1 branch
BranchTrueFalseTotal
if (@out and $shower) 0 0 0
Condition0%0/3
@out and $shower
!ll&&!rl&&r
000
MC/DC0%0/2
@out and $shower
@out $shower
Truth table0%0/3
A and B
A= @outB= $shower
ABresult
0X0
100
111
823 0 $shower = 0;
824 0 push @out, $wt{'SH'};
825 }
826 0 ▶ push @out, $wt{$report_vic} if $vic;
Branch: 1 branch
BranchTrueFalseTotal
if $vic 0 0 0
827  
828 0 return "~Weather Phenomena: " . join ' ', @out;
829 }
830  
831 # Runway Visual Range
832 package Geo::METARTAF::EN::RVR;
833 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
834 1 @ISA = qw(Geo::METARTAF::EN);
835  
836 sub as_string
837 0 ▶{
Subroutine as_string: not called CC=5 SCAR=34.0
838 0 my $self = shift;
839 0 my $out = "~Runway Visual Range: $self->[1] $self->[3]";
840 0 ▶ $out .= " varying to $self->[2] $self->[3]" if defined $self->[2];
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->[2] 0 0 0
841 0 ▶ if (defined $self->[4]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[4]) 0 0 0
842 0 ▶ $out .= " and decreasing" if $self->[4] eq 'D';
Branch: 1 branch
BranchTrueFalseTotal
if $self->[4] eq "D" 0 0 0
843 0 ▶ $out .= " and increasing" if $self->[4] eq 'U';
Branch: 1 branch
BranchTrueFalseTotal
if $self->[4] eq "U" 0 0 0
844 }
845 0 $out .= " on Runway $self->[0]";
846 0 return $out;
847 }
848  
849 package Geo::METARTAF::EN::RWY;
850 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
851 1 @ISA = qw(Geo::METARTAF::EN);
852  
853 sub as_string
854 0 ▶{
Subroutine as_string: not called CC=2 SCAR=17.9
855 0 my $self = shift;
856 0 ▶ my $out = $self->[0] eq 'LDG' ? "landing " : '';
Branch: 1 branch
BranchTrueFalseTotal
$self->[0] eq 'LDG' ? : 0 0 0
857 0 $out .= "runway $self->[1]";
858 0 return $out;
859 }
860  
861 # Visibility
862 package Geo::METARTAF::EN::VISIBILITY;
863 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
864 1 @ISA = qw(Geo::METARTAF::EN);
865  
866 sub as_string
867 0 ▶{
Subroutine as_string: not called CC=1 SCAR=6.9
868 0 my $self = shift;
869 0 return "~Visibility: $self->[0] $self->[1]";
870 }
871  
872 # Probability
873 package Geo::METARTAF::EN::PROB;
874 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
875 1 @ISA = qw(Geo::METARTAF::EN);
876  
877 sub as_string
878 0 ▶{
Subroutine as_string: not called CC=3 SCAR=24.8
879 0 my $self = shift;
880 0 my $out = "Probability $self->[0]%";
881 0 ▶ if (defined $self->[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[1]) 0 0 0
882 0 $out .= " between $self->[2]";
883 # If the day is the same for both times
884 0 ▶ if ($self->[1] == $self->[3]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->[1] == $self->[3]) { } 0 0 0
885 0 $out .= " and $self->[4] on the " . $self->day($self->[1]);
886 }
887 else {
888 0 $out .= " on the " . $self->day($self->[1]) . " and $self->[4] on the " . $self->day($self->[3]);
889 }
890 }
891 0 return $out;
892 }
893  
894 # Temporary
895 package Geo::METARTAF::EN::TEMPO;
896 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
897 1 @ISA = qw(Geo::METARTAF::EN);
898  
899 sub as_string
900 0 ▶{
Subroutine as_string: not called CC=2 SCAR=17.9
901 0 my $self = shift;
902 0 my $out = "Temporarily";
903 0 $out .= " between $self->[1]";
904 # If the day is the same for both times
905 0 ▶ if ($self->[0] == $self->[2]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->[0] == $self->[2]) { } 0 0 0
906 0 $out .= " and $self->[3] on the " . $self->day($self->[0]);
907 }
908 else {
909 0 $out .= " on the " . $self->day($self->[0]) . " and $self->[3] on the " . $self->day($self->[2]);
910 }
911 0 return $out;
912 }
913  
914 # Becoming
915 package Geo::METARTAF::EN::BECMG;
916 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
917 1 @ISA = qw(Geo::METARTAF::EN);
918  
919 sub as_string
920 0 ▶{
Subroutine as_string: not called CC=2 SCAR=17.9
921 0 my $self = shift;
922 0 my $out = "Becoming";
923 0 $out .= " between $self->[1]";
924 # If the day is the same for both times
925 0 ▶ if ($self->[0] == $self->[2]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->[0] == $self->[2]) { } 0 0 0
926 0 $out .= " and $self->[3] on the " . $self->day($self->[0]);
927 }
928 else {
929 0 $out .= " on the " . $self->day($self->[0]) . " and $self->[3] on the " . $self->day($self->[2]);
930 }
931 0 return $out;
932 }
933  
934 # From
935 package Geo::METARTAF::EN::FROM;
936 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
937 1 @ISA = qw(Geo::METARTAF::EN);
938  
939 sub as_string
940 0 ▶{
Subroutine as_string: not called CC=1 SCAR=6.9
941 0 my $self = shift;
942 0 my ($theDay, $theHour) = split(/-/, $self->[0]);
943 0 return "From $theHour on the " . $self->day($theDay);
944 }
945  
946 # Until
947 package Geo::METARTAF::EN::TIL;
948 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
949 1 @ISA = qw(Geo::METARTAF::EN);
950  
951 sub as_string
952 0 ▶{
Subroutine as_string: not called CC=1 SCAR=6.9
953 0 my $self = shift;
954 0 return "Until $self->[0]";
955 }
956  
957 # Autoload methods go after =cut, and are processed by the autosplit program.
958  
959 1 1;
960 __END__
↑ Summary