| 1 | package TaskPipe::InterpParam::Parts; | ||||||||||||
| 2 | |||||||||||||
| 3 | 40 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 40 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 40 | ▶ | 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 | 40 | has param_key => (is => 'rw', isa => 'Str'); | |||||||||||
| 19 | 40 | has param_val => (is => 'rw', isa => 'Str'); | |||||||||||
| 20 | |||||||||||||
| 21 | 40 | has label_key => (is => 'rw', isa => 'Str'); | |||||||||||
| 22 | 40 | has label_val => (is => 'rw', isa => 'Str'); | |||||||||||
| 23 | 40 | has match_count => (is => 'rw', isa => 'Int', default => 0); | |||||||||||
| 24 | 40 | has match_offset => (is => 'rw', isa => 'Int', default => 0); | |||||||||||
| 25 | 40 | 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
| |||||||||||||
| 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
| |||||||||||||
| 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
MC/DC0%0/1
$p{"match_count"} ||= 0
$p{"match_count"}
Truth table0%0/2
A
A= $p{"match_count"}
| |||||||||||||
| 48 | 0 | ▶ | $p{match_offset} ||= 0; | ||||||||||
|
Condition0%0/2
$p{"match_offset"} ||= 0
MC/DC0%0/1
$p{"match_offset"} ||= 0
$p{"match_offset"}
Truth table0%0/2
A
A= $p{"match_offset"}
| |||||||||||||
| 49 | 0 | ▶ | $p{input_key} ||= ''; | ||||||||||
|
Condition0%0/2
$p{"input_key"} ||= ""
MC/DC0%0/1
$p{"input_key"} ||= ""
$p{"input_key"}
Truth table0%0/2
A
A= $p{"input_key"}
| |||||||||||||
| 50 | |||||||||||||
| 51 | 0 | foreach my $k ( keys %p ){ | |||||||||||
| 52 | 0 | ▶ | $self->$k( $p{$k} ) if defined $p{$k}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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 | 40 | __PACKAGE__->meta->make_immutable; | |||||||||||
| 81 | |||||||||||||
| 82 | 40 | 1; | |||||||||||