| 1 | package Test2::V1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | our $VERSION = '1.302226'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use Carp qw/croak/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use Test2::V1::Base(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use Test2::V1::Handle(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | use Test2::Plugin::ExitSummary(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 4 | ▶ | use Test2::Plugin::SRand(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 4 | ▶ | use Test2::Plugin::UTF8(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 4 | ▶ | use Test2::Tools::Target(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # Magic reference to check against later | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 4 | my $SET = \'set'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # Lists of pragmas and plugins | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 4 | my @PRAGMAS = qw/strict warnings/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 4 | my @PLUGINS = qw/utf8 srand summary target/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 13 | ▶ | sub import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=17 SCAR=28.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 13 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 13 | my $caller = caller; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | croak "Got One or more undefined arguments, this usually means you passed in a single-character flag like '-p' without quoting it, which conflicts with the -p builtin" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 13 | ▶ | if grep { !defined($_) } @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 12 | my ($requested_exports, $options) = $class->_parse_args(\@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 12 | my $pragmas = $class->_compute_pragmas($options); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 12 | my $plugins = $class->_compute_plugins($options); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 12 | my ($handle_name, $handle) = $class->_build_handle($options); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 12 | my $ns = $handle->HANDLE_NAMESPACE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 12 | ▶ | unshift @$requested_exports => $handle->HANDLE_SUBS() if delete $options->{'-import'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 12 | ▶ | unshift @$requested_exports => grep { my $p = prototype($ns->can($_)); $p && $p =~ '&' } $handle->HANDLE_SUBS() if delete $options->{'-x'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$p && $p =~ /&/
MC/DC100%2/2
$p && $p =~ /&/
$p
$p =~ /&/
Truth table100%3/3
A && B
A= $pB= $p =~ /&/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 12 | my $exports = $class->_build_exports($handle, $requested_exports); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 12 | ▶ | unless (delete $options->{'-no-T2'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 9 | my $h = $handle; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | $exports->{$handle_name} = sub() { $h }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 12 | ▶ | croak "Unknown option(s): " . join(', ', sort keys %$options) if keys %$options; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 12 | ▶ | strict->import() if $pragmas->{strict}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 12 | ▶ | 'warnings'->import() if $pragmas->{warnings}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 12 | ▶ | Test2::Plugin::UTF8->import() if $plugins->{utf8}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 12 | ▶ | Test2::Plugin::ExitSummary->import() if $plugins->{summary}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 12 | ▶ | if (my $set = $plugins->{srand}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 4 | ▶ | Test2::Plugin::SRand->import((ref($set) && "$set" ne "$SET") ? $set->{seed} : ()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $set and "$set" ne "$SET"
MC/DC0%0/2
ref $set and "$set" ne "$SET"
ref $set
"$set" ne "$SET"
Truth table33%1/3
A and B
A= ref $setB= "$set" ne "$SET"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 12 | ▶ | if (my $target = $plugins->{target}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 4 | ▶ | Test2::Tools::Target->import_into($caller, $plugins->{target}) unless "$target" eq "$SET"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 12 | for my $exp (keys %$exports) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 4 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 599 | *{"$caller\::$exp"} = $exports->{$exp}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 12 | ▶ | sub _build_exports { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_exports: called CC=10 SCAR=23.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 12 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 12 | my ($handle, $requested) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 12 | my %exports; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 12 | ▶ | while (my $exp = shift @$requested) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 594 | ▶ | if ($exp =~ m/^!(.+)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 2 | delete $exports{$1}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 592 | ▶ | my $code = $handle->HANDLE_NAMESPACE->can($exp) or croak "requested export '$exp' is not available"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 592 | ▶ | my $args = shift @$requested if @$requested && ref($requested->[0]) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@$requested and ref $requested->[0] eq "HASH"
MC/DC100%2/2
@$requested and ref $requested->[0] eq "HASH"
@$requested
ref $requested->[0] eq "HASH"
Truth table100%3/3
A and B
A= @$requestedB= ref $requested->[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 592 | my $name = $exp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 592 | ▶ | if ($args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 1 | ▶ | $name = delete $args->{-as} if $args->{-as}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 1 | ▶ | $name = delete($args->{-prefix}) . $name if $args->{-prefix}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 1 | ▶ | $name = $name . delete($args->{-postfix}) if $args->{-postfix}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 592 | $exports{$name} = $code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 12 | return \%exports; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 12 | ▶ | sub _build_handle { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_handle: called CC=4 SCAR=15.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 12 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 12 | my ($options) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 12 | ▶ | my $handle_opts = delete $options->{'-T2'} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
delete $options->{'-T2'} || {}
MC/DC0%0/1
delete $options->{'-T2'} || {}
delete $options->{'-T2'}
Truth table50%1/2
A
A= delete $options->{'-T2'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 12 | ▶ | my $handle_name = delete $handle_opts->{'-as'} || delete $handle_opts->{'as'} || 'T2'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
delete $handle_opts->{'-as'} || delete $handle_opts->{'as'} || 'T2'
delete $handle_opts->{"-as"} or delete $handle_opts->{"as"}
MC/DC0%0/2
delete $handle_opts->{'-as'} || delete $handle_opts->{'as'} || 'T2'
delete $handle_opts->{"-as"}
delete $handle_opts->{"as"}
Truth table33%1/3
A or B
A= delete $handle_opts->{"-as"}B= delete $handle_opts->{"as"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 12 | my $handle = Test2::V1::Handle->new(%$handle_opts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 12 | return ($handle_name, $handle); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 12 | ▶ | sub _compute_plugins { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_compute_plugins: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 12 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 12 | my ($options) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 12 | my $plugins = { summary => $SET }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 12 | ▶ | if (my $plug = delete $options->{'-plugins'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 3 | ▶ | if (ref($plug)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $plugins = $plug; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 3 | $plugins = { map { $_ => $SET } @PLUGINS }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 12 | for my $plug (@PLUGINS) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 48 | my $set = delete $options->{"-$plug"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 48 | ▶ | $plugins->{$plug} = $set if $set && "$set" ne "$SET"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$set and "$set" ne "$SET"
MC/DC100%2/2
$set and "$set" ne "$SET"
$set
"$set" ne "$SET"
Truth table100%3/3
A and B
A= $setB= "$set" ne "$SET"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 48 | ▶ | $plugins->{$plug} = $set unless defined $plugins->{$plug}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 12 | return $plugins; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 12 | ▶ | sub _compute_pragmas { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_compute_pragmas: called CC=8 SCAR=21.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 12 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 12 | my ($options) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 12 | my $pragmas = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 12 | ▶ | if (my $prag = delete $options->{'-pragmas'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 3 | ▶ | if (ref($prag) && "$prag" ne "$SET") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $prag and "$prag" ne "$SET"
MC/DC0%0/2
ref $prag and "$prag" ne "$SET"
ref $prag
"$prag" ne "$SET"
Truth table33%1/3
A and B
A= ref $pragB= "$prag" ne "$SET"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $pragmas = $prag; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 3 | $pragmas = { map { $_ => $SET } @PRAGMAS }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 12 | for my $prag (@PRAGMAS) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 24 | my $set = delete $options->{"-$prag"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 24 | ▶ | $pragmas->{$prag} = $set if $set && "$set" ne "$SET"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$set and "$set" ne "$SET"
MC/DC0%0/2
$set and "$set" ne "$SET"
$set
"$set" ne "$SET"
Truth table66%2/3
A and B
A= $setB= "$set" ne "$SET"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 24 | ▶ | $pragmas->{$prag} = $set unless defined $pragmas->{$prag}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 12 | return $pragmas | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 12 | ▶ | sub _parse_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_args: called CC=21 SCAR=32.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 12 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 12 | my ($args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 12 | my (@exports, %options); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 12 | ▶ | while (my $arg = shift @$args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 24 | ▶ | $arg = '-T2' if $arg eq 'T2'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 24 | ▶ | push @exports => $arg and next unless substr($arg, 0, 1) eq '-'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
substr($arg, 0, 1) eq '-' || push(@exports, $arg) && (next)
push @exports, $arg and next
MC/DC0%0/2
substr($arg, 0, 1) eq '-' || push(@exports, $arg) && (next)
substr($arg, 0, 1) eq '-'
push @exports, $arg
Truth table66%2/3
A || B
A= substr($arg, 0, 1) eq '-'B= push @exports, $arg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 19 | ▶ | $options{$arg} = shift @$args and next if $arg eq '-target'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
$arg eq '-target' && (($options{$arg} = shift @$args) && (next))
$options{$arg} = shift @$args and next
MC/DC0%0/2
$arg eq '-target' && (($options{$arg} = shift @$args) && (next))
$arg eq '-target'
$options{$arg} = shift @$args
Truth table33%1/3
A && B
A= $arg eq '-target'B= $options{$arg} = shift @$args
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 15 | ▶ | $options{$arg} = (@$args && (ref($args->[0]) || "$args->[0]" eq "1" || "$args->[0]" eq "0")) ? shift @$args : $SET; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition44%4/9
@$args and ref $args->[0] || "$args->[0]" eq 1 || "$args->[0]" eq 0
ref $args->[0] or "$args->[0]" eq 1 or "$args->[0]" eq 0
ref $args->[0] or "$args->[0]" eq 1
MC/DC0%0/4
@$args and ref $args->[0] || "$args->[0]" eq 1 || "$args->[0]" eq 0
@$args
ref $args->[0]
"$args->[0]" eq 1
"$args->[0]" eq 0
Truth table40%2/5
A and B or C or D
A= @$argsB= ref $args->[0]C= "$args->[0]" eq 1D= "$args->[0]" eq 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 12 | ▶ | if (my $inc = delete $options{'-include'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $options{'-T2'}->{include} = $inc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 12 | for my $key (keys %options) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 19 | ▶ | next unless $key =~ m/^-([ipP]{1,3})$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 4 | delete $options{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 4 | for my $flag (split //, $1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 10 | $options{"-$flag"} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 12 | ▶ | $options{'-import'} ||= 1 if delete $options{'-i'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$options{"-import"} ||= 1
MC/DC0%0/1
$options{"-import"} ||= 1
$options{"-import"}
Truth table50%1/2
A
A= $options{"-import"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 12 | ▶ | $options{'-pragmas'} ||= 1 if delete $options{'-p'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$options{"-pragmas"} ||= 1
MC/DC0%0/1
$options{"-pragmas"} ||= 1
$options{"-pragmas"}
Truth table50%1/2
A
A= $options{"-pragmas"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 12 | ▶ | $options{'-plugins'} ||= 1 if delete $options{'-P'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$options{"-plugins"} ||= 1
MC/DC0%0/1
$options{"-plugins"} ||= 1
$options{"-plugins"}
Truth table50%1/2
A
A= $options{"-plugins"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 12 | return (\@exports, \%options); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||