Formatter/Format/Degree.pm

filter: Statementstmt 100% 26 / 26 Branchbran 100% 4 / 4 Conditioncond 75.0% 3 / 4 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 95.5% 43 / 45 CC 5 SCAR 10.4
CC
5
Cov
97%
encode
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.8
« Formatter.pm ↑ Summary Formatter/CalcurateDMS.pm »
1 package Geo::Formatter::Format::Degree;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use base qw(Geo::Formatter::FormatBase::Double);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 6 ▶use version; our $VERSION = qv('0.0.1');
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 7 ▶sub encode {
Subroutine encode: called CC=5 SCAR=16.1
Pod documented
11 7 my ($class,$lat,$lng,$opt) = @_;
12  
13 7 ▶ $opt ||= {};
Condition50%1/2
$opt ||= {}
l!l
70
MC/DC0%0/1
$opt ||= {}
$opt
Truth table50%1/2
A
A= $opt
Aresult
11
00
14  
15 7 ▶ my $under_decimal = defined($opt->{under_decimal}) ? $opt->{under_decimal} : 6;
Branch: 1 branch
BranchTrueFalseTotal
defined $opt->{'under_decimal'} ? : 4 3 7
16 7 ▶ my $sign = $opt->{sign} || 0;
Condition100%2/2
$opt->{'sign'} || 0
l!l
16
MC/DC100%1/1
$opt->{'sign'} || 0
$opt->{'sign'}
Truth table100%2/2
A
A= $opt->{'sign'}
Aresult
11
00
17  
18 7 ▶ my $form = sprintf("%%%s.%df",$sign ? "+" : "", $under_decimal);
Branch: 1 branch
BranchTrueFalseTotal
$sign ? : 1 6 7
19 7 map { sprintf($form,$_) } ($lat,$lng);
20 }
21  
22 6 ▶sub decode {
Subroutine decode: called CC=1 SCAR=0.0
Pod documented
23 6 map { $_ + 0.0 }@_[1..2];
24 }
25  
26 6 1;
27  
28 __END__
« Formatter.pm ↑ Summary Formatter/CalcurateDMS.pm »