lib/SVG/Estimate/Path/Moveto.pm

filter: Statementstmt 100% 22 / 22 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod 0.0% 0 / 1 totaltotal 96.5% 28 / 29 CC 3 SCAR 9.2
CC
3
Cov
100%
BUILDARGS
3.0
BEGIN
1.0
CRAP 2.5
« lib/SVG/Estimate/Role/ArgsWithUnits.pm ↑ Summary blib/lib/SVG/Estimate/Path/Command.pm »
1 package SVG::Estimate::Path::Moveto;
2 5 $SVG::Estimate::Path::Moveto::VERSION = '1.0116';
3 5 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 5 extends 'SVG::Estimate::Path::Command';
6 5 with 'SVG::Estimate::Role::Pythagorean';
7  
8 =head1 NAME
9  
10 SVG::Estimate::Path::Moveto - Handles estimating non-drawn movement.
11  
12 =head1 VERSION
13  
14 version 1.0116
15  
16 =head1 SYNOPSIS
17  
18 my $move = SVG::Estimate::Path::Moveto->new(
19 transformer => $transform,
20 start_point => [13, 19],
21 point => [45,13],
22 );
23  
24 my $travel_length = $move->travel_length;
25  
26 =head1 INHERITANCE
27  
28 This class extends L<SVG::Estimate::Path::Command> and consumes L<SVG::Estimate::Role::Pythagorean>.
29  
30 =head1 METHODS
31  
32 =head2 new()
33  
34 Constructor.
35  
36 =over
37  
38 =item point
39  
40 An array ref containing two floats that represent a point.
41  
42 =back
43  
44 =cut
45  
46 5 has point => (
47 is => 'ro',
48 required => 1,
49 );
50  
51 sub BUILDARGS {
52 11 ▶ my ($class, @args) = @_;
Subroutine BUILDARGS: called CC=3 SCAR=11.0
Pod undocumented
53 ##Upgrade to hashref
54 11 ▶ my $args = @args % 2 ? $args[0] : { @args };
Branch: 1 branch
BranchTrueFalseTotal
@args % 2 ? : 9 2 11
55 11 my $point = $args->{point};
56 11 ▶ if ($args->{transformer}->has_transforms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{"transformer"}->has_transforms) 3 8 11
57 3 $point = $args->{transformer}->transform($point);
58 }
59 11 $args->{start_point} = $args->{start_point};
60 11 $args->{end_point} = $point;
61 11 $args->{min_x} = $point->[0];
62 11 $args->{min_y} = $point->[1];
63 11 $args->{max_x} = $point->[0];
64 11 $args->{max_y} = $point->[1];
65 11 $args->{travel_length} = $class->pythagorean($args->{start_point}, $args->{end_point});
66 11 $args->{shape_length} = 0;
67 11 return $args;
68 }
69  
70 5 1;
« lib/SVG/Estimate/Role/ArgsWithUnits.pm ↑ Summary blib/lib/SVG/Estimate/Path/Command.pm »