| 1 | 7 | ▶ | use Stenciller::Standard; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 7 | ▶ | use Stenciller::Stencil; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # PODNAME: Stenciller::Wrap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 7 | ▶ | use Module::Pluggable search_path => ['Stenciller::Plugin']; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 7 | ▶ | class Stenciller::Wrap using Moose with Stenciller::Utils { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 7 | our $VERSION = '0.1302'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 7 | ▶ | use Module::Load; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 7 | ▶ | use Carp 'croak'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 7 | has filepath => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | isa => File, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | coerce => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | documentation => 'The textfile to parse.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 7 | has is_utf8 => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | isa => Bool, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | default => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | documentation => 'Determines how the stencil file is read.' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | has stencils => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | isa => ArrayRef[Stencil], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | traits => ['Array'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 7 | ▶ | default => sub { [ ] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 7 | documentation => 'After parsing, this contains all parsed stencils.', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | init_arg => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | handles => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | add_stencil => 'push', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | all_stencils => 'elements', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | get_stencil => 'get', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | count_stencils => 'count', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | has_stencils => 'count', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | has header_lines => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | isa => ArrayRef[Str], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | traits => ['Array'], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 7 | ▶ | default => sub { [] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 7 | init_arg => undef, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | documentation => 'After parsing, this contains all lines in the header.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | handles => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | add_header_line => 'push', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | all_header_lines => 'elements', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 7 | has skip_if_input_empty => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | isa => Bool, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | default => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | documentation => 'If a stencil has no input content, skip entire stencil.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 7 | has skip_if_output_empty => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | isa => Bool, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | default => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | documentation => 'If a stencil has no output content, skip entire stencil.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 7 | ▶ | around BUILDARGS($next: $class, @args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
:around: called CC=7 SCAR=21.8
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 7 | ▶ | if(scalar @args == 1 && ref $args[0] eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
scalar @args == 1 and ref $args[0] eq "HASH"
MC/DC0%0/2
scalar @args == 1 and ref $args[0] eq "HASH"
scalar @args == 1
ref $args[0] eq "HASH"
Truth table33%1/3
A and B
A= scalar @args == 1B= ref $args[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $class->$next(%{ $args[0] }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 7 | $class->$next(@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 7 | ▶ | method BUILD { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BUILD: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 7 | $self->parse; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 7 | ▶ | around has_stencils($next: $self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=3.3
Subroutine
:around: not called CC=5 SCAR=28.5
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my $count = $self->$next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | return !!$count || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
!!$count || 0
MC/DC0%0/1
!!$count || 0
!!$count
Truth table0%0/2
A
A= !!$count
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | method transform(Str :$plugin_name! does doc('Plugin to read contents with.'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | HashRef :$constructor_args? does doc('Constructor arguments for the plugin.') = {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | HashRef :$transform_args? does doc('Settings for the specific transformation.') = {}, ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | --> Str but assumed does doc('The transformed content.') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 7 | ▶ | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
transform: called CC=15 SCAR=27.9
Branch: 11 branches
Condition33%1/3
$#_ == 0 and ref $_[0] eq "HASH"
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0
ref $_[0] eq "HASH"
Truth table33%1/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 7 | my $plugin_class = "Stenciller::Plugin::$plugin_name"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 7 | Module::Load::load($plugin_class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 7 | ▶ | die sprintf "Can't load %s: %s", $plugin_class, $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 7 | ▶ | if(!$plugin_class->does('Stenciller::Transformer')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | croak("[$plugin_name] doesn't do the Stenciller::Transformer role. Quitting."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 7 | return $plugin_class->new(stenciller => $self, %{ $constructor_args })->transform($transform_args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 7 | ▶ | method parse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
parse: called CC=27 SCAR=33.4
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 7 | ▶ | my @contents = split /\v/ => $self->is_utf8 ? $self->filepath->slurp_utf8 : $self->filepath->slurp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 7 | my $stencil_start = qr/^== +stencil +(\{.*\} +)?==$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 7 | my $input_start = qr/^--+input--+$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 7 | my $input_end = qr/^--+end input--+$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 7 | my $output_start = qr/^--+output--+$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 7 | my $output_end = qr/^--+end output--+$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 7 | my $environment = 'header'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 7 | my $line_count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 7 | my $stencil = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | LINE: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 7 | foreach my $line (@contents) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 276 | ▶ | ++$line_count if $environment ne 'next_stencil'; # because then we are redo-ing the line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 276 | ▶ | if(any { $environment eq $_ } (qw/header next_stencil/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 36 | ▶ | $self->add_header_line($line) and next LINE if $line !~ $stencil_start; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
$line =~ /$stencil_start/u || $self->add_header_line($line) && (next LINE)
$self->add_header_line($line) and next LINE
MC/DC0%0/2
$line =~ /$stencil_start/u || $self->add_header_line($line) && (next LINE)
$line =~ /$stencil_start/u
$self->add_header_line($line)
Truth table66%2/3
A || B
A= $line =~ /$stencil_start/uB= $self->add_header_line($line)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 15 | my $possible_hash = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 15 | ▶ | my $settings = defined $possible_hash && $possible_hash =~ m{\{.*\}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $possible_hash and $possible_hash =~ /\{.*\}/u
MC/DC50%1/2
defined $possible_hash and $possible_hash =~ /\{.*\}/u
defined $possible_hash
$possible_hash =~ /\{.*\}/u
Truth table66%2/3
A and B
A= defined $possible_hashB= $possible_hash =~ /\{.*\}/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | ? $self->eval_to_hashref($possible_hash, $self->filepath) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | : {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 15 | ▶ | my $stencil_name = exists $settings->{'name'} ? delete $settings->{'name'} : $self->filepath->basename(qr/\..*/) . "-$line_count"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 15 | $stencil_name =~ s{[. -]}{_}g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 15 | $stencil_name =~ s{[^a-zA-Z0-9_]}{}g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | $stencil = Stenciller::Stencil->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | stencil_name => $stencil_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | loop_values => delete $settings->{'loop'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | line_number => $line_count, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | maybe skip => delete $settings->{'skip'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 15 | provided scalar keys %{ $settings }, extra_settings => $settings, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 15 | $environment = 'before_input'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | elsif($environment eq 'before_input') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 56 | ▶ | $stencil->add_before_input($line) and next LINE if $line !~ $input_start; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
$line =~ /$input_start/u || $stencil->add_before_input($line) && (next LINE)
$stencil->add_before_input($line) and next LINE
MC/DC0%0/2
$line =~ /$input_start/u || $stencil->add_before_input($line) && (next LINE)
$line =~ /$input_start/u
$stencil->add_before_input($line)
Truth table66%2/3
A || B
A= $line =~ /$input_start/uB= $stencil->add_before_input($line)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 15 | $environment = 'input'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | elsif($environment eq 'input') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 56 | ▶ | $stencil->add_input($line) and next LINE if $line !~ $input_end; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
$line =~ /$input_end/u || $stencil->add_input($line) && (next LINE)
$stencil->add_input($line) and next LINE
MC/DC0%0/2
$line =~ /$input_end/u || $stencil->add_input($line) && (next LINE)
$line =~ /$input_end/u
$stencil->add_input($line)
Truth table66%2/3
A || B
A= $line =~ /$input_end/uB= $stencil->add_input($line)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 15 | $environment = 'between'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | elsif($environment eq 'between') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 53 | ▶ | $stencil->add_between($line) and next LINE if $line !~ $output_start; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
$line =~ /$output_start/u || $stencil->add_between($line) && (next LINE)
$stencil->add_between($line) and next LINE
MC/DC0%0/2
$line =~ /$output_start/u || $stencil->add_between($line) && (next LINE)
$line =~ /$output_start/u
$stencil->add_between($line)
Truth table66%2/3
A || B
A= $line =~ /$output_start/uB= $stencil->add_between($line)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 15 | $environment = 'output'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | elsif($environment eq 'output') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 56 | ▶ | $stencil->add_output($line) and next LINE if $line !~ $output_end; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
$line =~ /$output_end/u || $stencil->add_output($line) && (next LINE)
$stencil->add_output($line) and next LINE
MC/DC0%0/2
$line =~ /$output_end/u || $stencil->add_output($line) && (next LINE)
$line =~ /$output_end/u
$stencil->add_output($line)
Truth table66%2/3
A || B
A= $line =~ /$output_end/uB= $stencil->add_output($line)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 15 | $environment = 'after_output'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | elsif($environment eq 'after_output') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 19 | ▶ | $stencil->add_after_output($line) and next LINE if $line !~ $stencil_start; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$line =~ /$stencil_start/u || $stencil->add_after_output($line) && (next LINE)
$stencil->add_after_output($line) and next LINE
MC/DC0%0/2
$line =~ /$stencil_start/u || $stencil->add_after_output($line) && (next LINE)
$line =~ /$stencil_start/u
$stencil->add_after_output($line)
Truth table66%2/3
A || B
A= $line =~ /$stencil_start/uB= $stencil->add_after_output($line)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 8 | $self->handle_completed_stencil($stencil); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 8 | $environment = 'next_stencil'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 8 | redo LINE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 7 | ▶ | if($environment ne 'after_output') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | croak (sprintf 'File <%s> appears malformed. Ended on <%s>', $self->filepath, $environment); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 7 | $self->handle_completed_stencil($stencil); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 7 | ▶ | method handle_completed_stencil(Maybe[Stencil] $stencil) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
handle_completed_stencil: called CC=14 SCAR=27.7
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 15 | ▶ | return if !Stencil->check($stencil); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 15 | ▶ | return if $stencil->skip; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 15 | ▶ | return if !$stencil->has_input && $self->skip_if_input_empty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $stencil->has_input and $self->skip_if_input_empty
MC/DC50%1/2
not $stencil->has_input and $self->skip_if_input_empty
not $stencil->has_input
$self->skip_if_input_empty
Truth table66%2/3
not(A) and B
A= not $stencil->has_inputB= $self->skip_if_input_empty
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 13 | ▶ | return if !$stencil->has_output && $self->skip_if_output_empty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $stencil->has_output and $self->skip_if_output_empty
MC/DC0%0/2
not $stencil->has_output and $self->skip_if_output_empty
not $stencil->has_output
$self->skip_if_output_empty
Truth table33%1/3
not(A) and B
A= not $stencil->has_outputB= $self->skip_if_output_empty
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 13 | ▶ | if(!$stencil->has_loop_values) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 12 | $self->add_stencil($stencil); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 12 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | foreach my $loop_value ($stencil->all_loop_values) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 2 | my $clone = $stencil->clone_with_loop_value($loop_value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 2 | $self->add_stencil($clone); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 7 | ▶ | method max_stencil_index { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
max_stencil_index: called CC=2 SCAR=7.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 9 | return $self->count_stencils - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | Stenciller::Wrap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | Version 0.1302, released 2015-11-28. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | =head1 SOURCE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | L<https://github.com/Csson/p5-Stenciller> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | =head1 HOMEPAGE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | L<https://metacpan.org/release/Stenciller> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | Erik Carlsson <info@code301.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | This software is copyright (c) 2015 by Erik Carlsson. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||