lib/BioX/Workflow/Command/run/Rules/Directives/Interpolate/Mustache.pm

filter: Statementstmt 46.1% 12 / 26 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 31.9% 15 / 47 CC 6 SCAR 33.4
CC
6
Cov
32%
interpol_directive
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 28.3
« lib/BioX/Workflow/Command/Exceptions.pm ↑ Summary lib/BioX/Workflow/Command/run/Utils/Samples.pm »
1 package BioX::Workflow::Command::run::Rules::Directives::Interpolate::Mustache;
2  
3 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Template::Mustache;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 has 'delimiter' => (
9 is => 'rw',
10 isa => 'Str',
11 default => '{',
12 );
13  
14 1 has 'sample_var' => (
15 is => 'rw',
16 isa => 'Str',
17 lazy => 1,
18 default => '{{{sample}}}',
19 );
20  
21 0 ▶sub interpol_directive {
Subroutine interpol_directive: not called CC=6 SCAR=37.4
Pod undocumented
22 0 my $self = shift;
23 0 my $k = shift;
24 0 my $source = shift;
25 0 my $text = '';
26  
27 #The $ is not always at the beginning
28 0 ▶ if ( exists $self->interpol_directive_cache->{$source} && $source !~ m/{/ )
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->interpol_directive_cache->{$source} and not $source =~ /{/) 0 0 0
Condition0%0/3
exists $self->interpol_directive_cache->{$source} and not $source =~ /{/
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->interpol_directive_cache->{$source} and not $source =~ /{/
exists $self->interpol_directive_cache->{$source} not $source =~ /{/
Truth table0%0/3
A and not(B)
A= exists $self->interpol_directive_cache->{$source}B= not $source =~ /{/
ABresult
0X0
100
111
29 {
30 0 return $self->interpol_directive_cache->{$source};
31 }
32  
33 0 ▶ if ( $source !~ m/{/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($source =~ /{/) 0 0 0
34 0 $self->interpol_directive_cache->{$source} = $source;
35 0 return $source;
36 }
37  
38 0 $text = Template::Mustache->render( $source, $self );
39 0 $self->interpol_directive_cache->{$source} = $text;
40  
41 ##If its the same and it has a $sign, its probably a perl expression
42 0 ▶ if ($text eq $source && $text =~ m/\$/){
Branch: 1 branch
BranchTrueFalseTotal
if ($text eq $source and $text =~ /\$/) 0 0 0
Condition0%0/3
$text eq $source and $text =~ /\$/
!ll&&!rl&&r
000
MC/DC0%0/2
$text eq $source and $text =~ /\$/
$text eq $source $text =~ /\$/
Truth table0%0/3
A and B
A= $text eq $sourceB= $text =~ /\$/
ABresult
0X0
100
111
43 0 return $self->interpol_text_template($source);
44 }
45 0 return $text;
46  
47 }
48  
49 1 1;
« lib/BioX/Workflow/Command/Exceptions.pm ↑ Summary lib/BioX/Workflow/Command/run/Utils/Samples.pm »