OpenWeatherMap/Units.pm

filter: Statementstmt 100% 26 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 4 totaltotal 90.0% 36 / 40 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« OpenWeatherMap.pm ↑ Summary OpenWeatherMap/Request/Current.pm »
1 package Weather::OpenWeatherMap::Units;
2 4 $Weather::OpenWeatherMap::Units::VERSION = '0.005001';
3 4 ▶use feature 'state';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶use Types::Standard -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 4 ▶use parent 'Exporter::Tiny';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 our @EXPORT = our @EXPORT_OK = qw/
11 f_to_c
12 mph_to_kph
13 deg_to_compass
14 CoercedInt
15 /;
16  
17 17 ▶sub f_to_c { ($_[0] - 32) * (5/9) }
Subroutine f_to_c: called CC=1 SCAR=0.0
Pod undocumented
18  
19 10 ▶sub mph_to_kph { $_[0] * 1.609344 }
Subroutine mph_to_kph: called CC=1 SCAR=0.0
Pod undocumented
20  
21 sub deg_to_compass {
22 # I think I stole this from a stackoverflow answer I read, once.
23 # Credit where it's due except I can't recall where that might be...
24 13 ▶ my $val = int( ($_[0] / 22.5) + 0.5 );
Subroutine deg_to_compass: called CC=1 SCAR=0.0
Pod undocumented
25 13 state $compass = [qw/
26 N NNE NE ENE E ESE SE SSE S SSW SW WSW W WNW NW NNW
27 /];
28 13 $compass->[ $val % 16 ]
29 }
30  
31 47 ▶my $CoercedInt = Int->plus_coercions(StrictNum, sub { int });
Subroutine __ANON__: called CC=1 SCAR=0.0
32 35 ▶sub CoercedInt { $CoercedInt }
Subroutine CoercedInt: called CC=1 SCAR=0.0
Pod undocumented
33  
34 =pod
35  
36 =for Pod::Coverage .*
37  
38 =cut
39  
40 4 1;
« OpenWeatherMap.pm ↑ Summary OpenWeatherMap/Request/Current.pm »