TaskPipe/InterpParam/Parts.pm

filter: Statementstmt 58.0% 18 / 31 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 41.1% 21 / 51 CC 9 SCAR 42.2
CC
9
Cov
42%
load
90.0
BEGIN
1.0
BEGIN
1.0
CRAP 67.8
« TaskPipe/Task_Record.pm ↑ Summary TaskPipe/Task_Scrape.pm »
1 package TaskPipe::InterpParam::Parts;
2  
3 38 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 38 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 38 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 #
8 # task:
9 # _name: SomeTaskName
10 # <param_key>: <param_val>
11 #
12 # where <param_val> breaks down as:
13 #
14 # $<label_key>:<label_val>(<match_count>)[<match_offset>]{input_key}
15  
16  
17  
18 38 has param_key => (is => 'rw', isa => 'Str');
19 38 has param_val => (is => 'rw', isa => 'Str');
20  
21 38 has label_key => (is => 'rw', isa => 'Str');
22 38 has label_val => (is => 'rw', isa => 'Str');
23 38 has match_count => (is => 'rw', isa => 'Int', default => 0);
24 38 has match_offset => (is => 'rw', isa => 'Int', default => 0);
25 38 has input_key => (is => 'rw', isa => 'Str');
26  
27  
28 sub load{
29 0 ▶ my $self = shift;
Subroutine load: not called CC=9 SCAR=45.0
Pod undocumented
30  
31 0 ▶ confess "param_val must be provided" unless $self->param_val;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->param_val 0 0 0
32  
33 0 my %p;
34 ($p{label_key},
35 $p{label_val},
36 $p{match_count},
37 $p{match_offset},
38 $p{input_key})
39 0 = $self->param_val =~ /^\$(\w+)(:\w+|)(\(\s*\d+\s*\)|)(\[\s*\d+\s*\]|)(\{\s*(?:\w+|\*)\s*\}|)\s*$/;
40  
41 0 foreach my $k ( keys %p ){
42 0 ▶ next unless $p{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless $p{$k} 0 0 0
43 0 $p{$k} =~ s/\s+//g;
44 0 $p{$k} =~ s/[^\w\*]+//g;
45 }
46  
47 0 ▶ $p{match_count} ||= 0;
Condition0%0/2
$p{"match_count"} ||= 0
l!l
00
MC/DC0%0/1
$p{"match_count"} ||= 0
$p{"match_count"}
Truth table0%0/2
A
A= $p{"match_count"}
Aresult
11
00
48 0 ▶ $p{match_offset} ||= 0;
Condition0%0/2
$p{"match_offset"} ||= 0
l!l
00
MC/DC0%0/1
$p{"match_offset"} ||= 0
$p{"match_offset"}
Truth table0%0/2
A
A= $p{"match_offset"}
Aresult
11
00
49 0 ▶ $p{input_key} ||= '';
Condition0%0/2
$p{"input_key"} ||= ""
l!l
00
MC/DC0%0/1
$p{"input_key"} ||= ""
$p{"input_key"}
Truth table0%0/2
A
A= $p{"input_key"}
Aresult
11
00
50  
51 0 foreach my $k ( keys %p ){
52 0 ▶ $self->$k( $p{$k} ) if defined $p{$k};
Branch: 1 branch
BranchTrueFalseTotal
if defined $p{$k} 0 0 0
53 }
54  
55 }
56  
57 =head1 NAME
58  
59 TaskPipe::InterpParam::Parts - module determining the parts of a plan parameter variable
60  
61 =head1 DESCRIPTION
62  
63 A class to store the different parts of a parameter variable. It is not recommended to use this module directly. See the general manpages for TaskPipe.
64  
65 =head1 AUTHOR
66  
67 Tom Gracey <tomgracey@gmail.com>
68  
69 =head1 COPYRIGHT AND LICENSE
70  
71 Copyright (c) Tom Gracey 2018
72  
73 TaskPipe is free software, licensed under
74  
75 The GNU Public License Version 3
76  
77 =cut
78  
79  
80 38 __PACKAGE__->meta->make_immutable;
81  
82 38 1;
« TaskPipe/Task_Record.pm ↑ Summary TaskPipe/Task_Scrape.pm »