LineTrace/Figure.pm

filter: Statementstmt 100% 21 / 21 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 96.8% 31 / 32 CC 4 SCAR 10.0
CC
4
Cov
100%
new
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« LineTrace.pm ↑ Summary
1 package Imager::LineTrace::Figure;
2 2 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 11 ▶sub new {
Subroutine new: called CC=4 SCAR=13.9
Pod undocumented
7 11 my $pkg = shift;
8 11 my $args_ref = shift;
9  
10 my @points = map {
11 23 bless $_, 'Imager::LineTrace::Point';
12 11 } @{$args_ref->{points}};
13  
14 11 my $type = "Undefined";
15 11 ▶ if ( $args_ref->{is_closed} ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($args_ref->{'is_closed'}) { } 1 10 11
elsif (3 <= scalar @points) { } 4 6 10
elsif (2 <= scalar @points) { } 1 5 6
16 1 $type = "Polygon";
17 }
18 elsif ( 3 <= scalar(@points) ) {
19 4 $type = "Polyline";
20 }
21 elsif ( 2 <= scalar(@points) ) {
22 1 $type = "Line";
23 }
24 else {
25 5 $type = "Point";
26 }
27  
28 bless {
29 points => \@points,
30 is_closed => $args_ref->{is_closed},
31 value => $args_ref->{value},
32 11 type => $type
33 }, $pkg;
34 }
35  
36 2 1;
37 __END__
« LineTrace.pm ↑ Summary