Primitive/Circle.pm

filter: Statementstmt 68.7% 22 / 32 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 54.5% 6 / 11 Podpod 100% 6 / 6 totaltotal 69.3% 34 / 49 CC 1 SCAR 3.7
CC
1
Cov
69%
area
2.0
circumference
2.0
point_end
2.0
CRAP 1.5
« Primitive/Rectangle.pm ↑ Summary Primitive/Polygon.pm »
1 package Geometry::Primitive::Circle;
2 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use MooseX::Storage;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 with qw(Geometry::Primitive::Shape MooseX::Clone MooseX::Storage::Deferred);
6  
7 2 ▶use Geometry::Primitive::Point;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Math::Trig ':pi';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 has 'origin' => (
11 is => 'rw',
12 isa => 'Geometry::Primitive::Point',
13 coerce => 1
14 );
15 2 has 'radius' => (
16 is => 'rw',
17 isa => 'Num',
18 default => 0
19 );
20  
21 0 ▶sub area {
Subroutine area: not called CC=1 SCAR=6.9
Pod documented
22 0 my ($self) = @_;
23 0 return $self->radius**2 * pi;
24 };
25  
26 0 ▶sub circumference {
Subroutine circumference: not called CC=1 SCAR=6.9
Pod documented
27 0 my ($self) = @_;
28  
29 0 return $self->diameter * pi;
30 }
31  
32 1 ▶sub diameter {
Subroutine diameter: called CC=1 SCAR=0.0
Pod documented
33 1 my ($self) = @_;
34  
35 1 return $self->radius * 2;
36 }
37  
38 0 ▶sub point_end {
Subroutine point_end: not called CC=1 SCAR=6.9
Pod documented
39 0 my ($self) = @_;
40  
41 0 return $self->point_start;
42 }
43  
44 0 ▶sub point_start {
Subroutine point_start: not called CC=1 SCAR=6.9
Pod documented
45 0 my ($self) = @_;
46  
47 0 return Geometry::Primitive::Point->new(
48 x => $self->origin->x,
49 y => $self->origin->y - ($self->radius / 2)
50 );
51 }
52  
53 0 ▶sub scale {
Subroutine scale: not called CC=1 SCAR=6.9
Pod documented
54 0 my ($self, $amount) = @_;
55  
56 0 return Geometry::Primitive::Circle->new(
57 radius => $self->radius * $amount
58 );
59 }
60  
61 2 __PACKAGE__->meta->make_immutable;
62  
63 2 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
64 2 1;
65  
66 __END__
« Primitive/Rectangle.pm ↑ Summary Primitive/Polygon.pm »