| 1 | # build and eval the code to efficiently merge several iterators in one iterator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | package Iterator::Merger; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use base 'Exporter'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | our $VERSION = '0.62'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use constant DEBUG => 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | our @EXPORT_OK = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | imerge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | imerge_num | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | imerge_raw | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | our %EXPORT_TAGS = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | all => \@EXPORT_OK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | ▶ | use constant HAS_ARRAY_HEAP => eval "use Array::Heap;1"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | our $Max_generate; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 2 | ▶ | unless (defined $Max_generate) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | $Max_generate = HAS_ARRAY_HEAP ? 9 : 12; # 10 => ~30KiB to eval (doubles each increment) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 2 | my %Generator_cache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 225 | ▶ | *imerge_raw = eval q! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=20.4
Branch: 5 branches
Condition66%8/12
&$ite // do {
{
$ite = shift @ites || (return);
&$ite // (redo);
}
}
shift @ites || (return)
&$ite // (redo)
eval qq[\n\t# try to use the defined-or operator\n\tsub {\n\t\tmy \@ites = \@_ or return sub {};\n\t\tif (\@ites==1) {\n\t\t\tmy \$ite = shift;\n\t\t\treturn ref(\$ite) eq 'GLOB' ? sub {scalar <\$ite>} : sub {scalar &\$ite};\n\t\t}\n\t\tfor (\@ites) {\n\t\t\tif (ref(\$_) eq 'GLOB') {\n\t\t\t\tmy \$fh = \$_;\n\t\t\t\t\$_ = sub {<\$fh>}\n\t\t\t}\n\t\t}\n\t\tcroak "arguments must be CODE references or filehandles" if grep {ref(\$_) ne 'CODE'} \@ites;\n\t\tmy \$ite = shift(\@ites);\n\t\tsub {\n\t\t\t&\$ite // do {\n\t\t\t\t{ # block for redo\n\t\t\t\t\t\$ite = shift(\@ites) || return;\n\t\t\t\t\t&\$ite // redo\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n] || eval qq[\n\t# default to use defined() and a temporary variable\n\tsub {\n\t\tmy \@ites = \@_ or return sub {};\n\t\tif (\@ites==1) {\n\t\t\tmy \$ite = shift;\n\t\t\treturn ref(\$ite) eq 'GLOB' ? sub {scalar <\$ite>} : sub {scalar &\$ite};\n\t\t}\n\t\tfor (\@ites) {\n\t\t\tif (ref(\$_) eq 'GLOB') {\n\t\t\t\tmy \$fh = \$_;\n\t\t\t\t\$_ = sub {<\$fh>}\n\t\t\t}\n\t\t}\n\t\tcroak "arguments must be CODE references or filehandles" if grep {ref(\$_) ne 'CODE'} \@ites;\n\t\tmy \$ite = shift(\@ites);\n\t\tsub {\n\t\t\tmy \$next = &\$ite;\n\t\t\tuntil (defined \$next) {\n\t\t\t\t\$ite = shift(\@ites) || return;\n\t\t\t\t\$next = &\$ite;\n\t\t\t}\n\t\t\t\$next\n\t\t}\n\t}\n] || die($@)
eval "\n\t# try to use the defined-or operator\n\tsub {\n\t\tmy \@ites = \@_ or return sub {};\n\t\tif (\@ites==1) {\n\t\t\tmy \$ite = shift;\n\t\t\treturn ref(\$ite) eq 'GLOB' ? sub {scalar <\$ite>} : sub {scalar &\$ite};\n\t\t}\n\t\tfor (\@ites) {\n\t\t\tif (ref(\$_) eq 'GLOB') {\n\t\t\t\tmy \$fh = \$_;\n\t\t\t\t\$_ = sub {<\$fh>}\n\t\t\t}\n\t\t}\n\t\tcroak \"arguments must be CODE references or filehandles\" if grep {ref(\$_) ne 'CODE'} \@ites;\n\t\tmy \$ite = shift(\@ites);\n\t\tsub {\n\t\t\t&\$ite // do {\n\t\t\t\t{ # block for redo\n\t\t\t\t\t\$ite = shift(\@ites) || return;\n\t\t\t\t\t&\$ite // redo\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n" or eval "\n\t# default to use defined() and a temporary variable\n\tsub {\n\t\tmy \@ites = \@_ or return sub {};\n\t\tif (\@ites==1) {\n\t\t\tmy \$ite = shift;\n\t\t\treturn ref(\$ite) eq 'GLOB' ? sub {scalar <\$ite>} : sub {scalar &\$ite};\n\t\t}\n\t\tfor (\@ites) {\n\t\t\tif (ref(\$_) eq 'GLOB') {\n\t\t\t\tmy \$fh = \$_;\n\t\t\t\t\$_ = sub {<\$fh>}\n\t\t\t}\n\t\t}\n\t\tcroak \"arguments must be CODE references or filehandles\" if grep {ref(\$_) ne 'CODE'} \@ites;\n\t\tmy \$ite = shift(\@ites);\n\t\tsub {\n\t\t\tmy \$next = &\$ite;\n\t\t\tuntil (defined \$next) {\n\t\t\t\t\$ite = shift(\@ites) || return;\n\t\t\t\t\$next = &\$ite;\n\t\t\t}\n\t\t\t\$next\n\t\t}\n\t}\n"
MC/DC50%1/2
&$ite // do {
{
$ite = shift @ites || (return);
&$ite // (redo);
}
}
&$ite
do {
{
$ite = shift @ites || (return);
&$ite // (redo);
}
}
MC/DC100%1/1
shift @ites || (return)
shift @ites
MC/DC100%1/1
&$ite // (redo)
&$ite
MC/DC0%0/2
eval qq[\n\t# try to use the defined-or operator\n\tsub {\n\t\tmy \@ites = \@_ or return sub {};\n\t\tif (\@ites==1) {\n\t\t\tmy \$ite = shift;\n\t\t\treturn ref(\$ite) eq 'GLOB' ? sub {scalar <\$ite>} : sub {scalar &\$ite};\n\t\t}\n\t\tfor (\@ites) {\n\t\t\tif (ref(\$_) eq 'GLOB') {\n\t\t\t\tmy \$fh = \$_;\n\t\t\t\t\$_ = sub {<\$fh>}\n\t\t\t}\n\t\t}\n\t\tcroak "arguments must be CODE references or filehandles" if grep {ref(\$_) ne 'CODE'} \@ites;\n\t\tmy \$ite = shift(\@ites);\n\t\tsub {\n\t\t\t&\$ite // do {\n\t\t\t\t{ # block for redo\n\t\t\t\t\t\$ite = shift(\@ites) || return;\n\t\t\t\t\t&\$ite // redo\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n] || eval qq[\n\t# default to use defined() and a temporary variable\n\tsub {\n\t\tmy \@ites = \@_ or return sub {};\n\t\tif (\@ites==1) {\n\t\t\tmy \$ite = shift;\n\t\t\treturn ref(\$ite) eq 'GLOB' ? sub {scalar <\$ite>} : sub {scalar &\$ite};\n\t\t}\n\t\tfor (\@ites) {\n\t\t\tif (ref(\$_) eq 'GLOB') {\n\t\t\t\tmy \$fh = \$_;\n\t\t\t\t\$_ = sub {<\$fh>}\n\t\t\t}\n\t\t}\n\t\tcroak "arguments must be CODE references or filehandles" if grep {ref(\$_) ne 'CODE'} \@ites;\n\t\tmy \$ite = shift(\@ites);\n\t\tsub {\n\t\t\tmy \$next = &\$ite;\n\t\t\tuntil (defined \$next) {\n\t\t\t\t\$ite = shift(\@ites) || return;\n\t\t\t\t\$next = &\$ite;\n\t\t\t}\n\t\t\t\$next\n\t\t}\n\t}\n] || die($@)
eval "\n\t# try to use the defined-or operator\n\tsub {\n\t\tmy \@ites = \@_ or return sub {};\n\t\tif (\@ites==1) {\n\t\t\tmy \$ite = shift;\n\t\t\treturn ref(\$ite) eq 'GLOB' ? sub {scalar <\$ite>} : sub {scalar &\$ite};\n\t\t}\n\t\tfor (\@ites) {\n\t\t\tif (ref(\$_) eq 'GLOB') {\n\t\t\t\tmy \$fh = \$_;\n\t\t\t\t\$_ = sub {<\$fh>}\n\t\t\t}\n\t\t}\n\t\tcroak \"arguments must be CODE references or filehandles\" if grep {ref(\$_) ne 'CODE'} \@ites;\n\t\tmy \$ite = shift(\@ites);\n\t\tsub {\n\t\t\t&\$ite // do {\n\t\t\t\t{ # block for redo\n\t\t\t\t\t\$ite = shift(\@ites) || return;\n\t\t\t\t\t&\$ite // redo\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n"
eval "\n\t# default to use defined() and a temporary variable\n\tsub {\n\t\tmy \@ites = \@_ or return sub {};\n\t\tif (\@ites==1) {\n\t\t\tmy \$ite = shift;\n\t\t\treturn ref(\$ite) eq 'GLOB' ? sub {scalar <\$ite>} : sub {scalar &\$ite};\n\t\t}\n\t\tfor (\@ites) {\n\t\t\tif (ref(\$_) eq 'GLOB') {\n\t\t\t\tmy \$fh = \$_;\n\t\t\t\t\$_ = sub {<\$fh>}\n\t\t\t}\n\t\t}\n\t\tcroak \"arguments must be CODE references or filehandles\" if grep {ref(\$_) ne 'CODE'} \@ites;\n\t\tmy \$ite = shift(\@ites);\n\t\tsub {\n\t\t\tmy \$next = &\$ite;\n\t\t\tuntil (defined \$next) {\n\t\t\t\t\$ite = shift(\@ites) || return;\n\t\t\t\t\$next = &\$ite;\n\t\t\t}\n\t\t\t\$next\n\t\t}\n\t}\n"
Truth table66%2/3
A // B
A= &$iteB= do {
{
$ite = shift @ites || (return);
&$ite // (redo);
}
}
Truth table100%2/2
A
A= shift @ites
Truth table100%2/2
A
A= &$ite
Truth table33%1/3
A or B
A= eval "\n\t# try to use the defined-or operator\n\tsub {\n\t\tmy \@ites = \@_ or return sub {};\n\t\tif (\@ites==1) {\n\t\t\tmy \$ite = shift;\n\t\t\treturn ref(\$ite) eq 'GLOB' ? sub {scalar <\$ite>} : sub {scalar &\$ite};\n\t\t}\n\t\tfor (\@ites) {\n\t\t\tif (ref(\$_) eq 'GLOB') {\n\t\t\t\tmy \$fh = \$_;\n\t\t\t\t\$_ = sub {<\$fh>}\n\t\t\t}\n\t\t}\n\t\tcroak \"arguments must be CODE references or filehandles\" if grep {ref(\$_) ne 'CODE'} \@ites;\n\t\tmy \$ite = shift(\@ites);\n\t\tsub {\n\t\t\t&\$ite // do {\n\t\t\t\t{ # block for redo\n\t\t\t\t\t\$ite = shift(\@ites) || return;\n\t\t\t\t\t&\$ite // redo\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n"B= eval "\n\t# default to use defined() and a temporary variable\n\tsub {\n\t\tmy \@ites = \@_ or return sub {};\n\t\tif (\@ites==1) {\n\t\t\tmy \$ite = shift;\n\t\t\treturn ref(\$ite) eq 'GLOB' ? sub {scalar <\$ite>} : sub {scalar &\$ite};\n\t\t}\n\t\tfor (\@ites) {\n\t\t\tif (ref(\$_) eq 'GLOB') {\n\t\t\t\tmy \$fh = \$_;\n\t\t\t\t\$_ = sub {<\$fh>}\n\t\t\t}\n\t\t}\n\t\tcroak \"arguments must be CODE references or filehandles\" if grep {ref(\$_) ne 'CODE'} \@ites;\n\t\tmy \$ite = shift(\@ites);\n\t\tsub {\n\t\t\tmy \$next = &\$ite;\n\t\t\tuntil (defined \$next) {\n\t\t\t\t\$ite = shift(\@ites) || return;\n\t\t\t\t\$next = &\$ite;\n\t\t\t}\n\t\t\t\$next\n\t\t}\n\t}\n"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # try to use the defined-or operator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | my @ites = @_ or return sub {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | if (@ites==1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | my $ite = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | return ref($ite) eq 'GLOB' ? sub {scalar <$ite>} : sub {scalar &$ite}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | for (@ites) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | if (ref($_) eq 'GLOB') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | my $fh = $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | $_ = sub {<$fh>} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | croak "arguments must be CODE references or filehandles" if grep {ref($_) ne 'CODE'} @ites; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | my $ite = shift(@ites); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | &$ite // do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | { # block for redo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | $ite = shift(@ites) || return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | &$ite // redo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | ! || eval q! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # default to use defined() and a temporary variable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | my @ites = @_ or return sub {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | if (@ites==1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | my $ite = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | return ref($ite) eq 'GLOB' ? sub {scalar <$ite>} : sub {scalar &$ite}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | for (@ites) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | if (ref($_) eq 'GLOB') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | my $fh = $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | $_ = sub {<$fh>} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | croak "arguments must be CODE references or filehandles" if grep {ref($_) ne 'CODE'} @ites; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | my $ite = shift(@ites); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | my $next = &$ite; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | until (defined $next) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | $ite = shift(@ites) || return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | $next = &$ite; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | $next | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | ! || die $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | sub imerge { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 225 | ▶ | _imerge(1, \@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
imerge: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | sub imerge_num { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 225 | ▶ | _imerge(0, \@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
imerge_num: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | sub _imerge { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 450 | ▶ | my ($lex, $iterators) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_imerge: called CC=18 SCAR=30.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 450 | my $nb = @$iterators; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 450 | ▶ | croak "arguments must be CODE references or filehandles" if grep {ref($_) !~ /^CODE$|^GLOB$/} @$iterators; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 448 | ▶ | if ($nb==0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 24 | ▶ | return sub {undef}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | elsif ($nb==1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | #return $iterators->[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # ensure scalar context | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 32 | my $ite = $iterators->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 32 | ▶ | return ref($ite) eq 'GLOB' ? sub {scalar <$ite>} : sub {scalar &$ite}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | elsif ($nb <= $Max_generate) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 224 | DEBUG && warn "generate"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 224 | ▶ | if ($nb == grep {ref($_) eq 'GLOB'} @$iterators) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # only globs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | my $code = $Generator_cache{$nb, $lex, 1} ||= _merger_generator($nb, $lex, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$Generator_cache{join $;, $nb, $lex, 1} ||= _merger_generator($nb, $lex, 1)
MC/DC0%0/2
$Generator_cache{join $;, $nb, $lex, 1} ||= _merger_generator($nb, $lex, 1)
$Generator_cache{join $;, $nb, $lex, 1}
_merger_generator($nb, $lex, 1)
Truth table0%0/3
A ||= B
A= $Generator_cache{join $;, $nb, $lex, 1}B= _merger_generator($nb, $lex, 1)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | return $code->(@$iterators); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 224 | for (@$iterators) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 1232 | ▶ | if (ref($_) eq 'GLOB') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | my $fh = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | $_ = sub {<$fh>} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 224 | ▶ | my $code = $Generator_cache{$nb, $lex, 0} ||= _merger_generator($nb, $lex, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$Generator_cache{join $;, $nb, $lex, 0} ||= _merger_generator($nb, $lex, 0)
MC/DC0%0/2
$Generator_cache{join $;, $nb, $lex, 0} ||= _merger_generator($nb, $lex, 0)
$Generator_cache{join $;, $nb, $lex, 0}
_merger_generator($nb, $lex, 0)
Truth table66%2/3
A ||= B
A= $Generator_cache{join $;, $nb, $lex, 0}B= _merger_generator($nb, $lex, 0)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 224 | return $code->(@$iterators); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | # no generation, giveup on some ultimate optim: lets turn all GLOBs to CODEs... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 168 | for (@$iterators) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 2100 | ▶ | if (ref($_) eq 'GLOB') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | my $fh = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | $_ = sub {<$fh>} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 168 | if (HAS_ARRAY_HEAP) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 168 | DEBUG && warn "heap"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | # general case, use a heap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 168 | my @heap; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # cannot take references to *_heap_lex and *_heap functions, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | # due to prototype problems... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 168 | ▶ | if ($lex) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 84 | for my $ite (@$iterators) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 1050 | my $val = &$ite; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 1050 | ▶ | Array::Heap::push_heap_lex(@heap, [$val, $ite]) if defined $val; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 61898 | ▶ | my $data = Array::Heap::pop_heap_lex(@heap) || return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
Condition100%2/2
&Array::Heap::pop_heap_lex(\@heap) || (return undef)
MC/DC100%1/1
&Array::Heap::pop_heap_lex(\@heap) || (return undef)
&Array::Heap::pop_heap_lex(\@heap)
Truth table100%2/2
A
A= &Array::Heap::pop_heap_lex(\@heap)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 53414 | my $min = $data->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 53414 | ▶ | if ( defined($data->[0] = $data->[1]->()) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 52382 | Array::Heap::push_heap_lex(@heap, $data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | $min | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 84 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 84 | for my $ite (@$iterators) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 1050 | my $val = &$ite; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 1050 | ▶ | Array::Heap::push_heap(@heap, [$val, $ite]) if defined $val; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 60800 | ▶ | my $data = Array::Heap::pop_heap(@heap) || return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
Condition100%2/2
&Array::Heap::pop_heap(\@heap) || (return undef)
MC/DC100%1/1
&Array::Heap::pop_heap(\@heap) || (return undef)
&Array::Heap::pop_heap(\@heap)
Truth table100%2/2
A
A= &Array::Heap::pop_heap(\@heap)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 52316 | my $min = $data->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 52316 | ▶ | if ( defined($data->[0] = $data->[1]->()) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 51284 | Array::Heap::push_heap(@heap, $data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | $min | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 84 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | DEBUG && warn "brutal"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | # no heap available, lets be dirty | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | my @values = map {scalar &$_} @$iterators; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | # warn "values: ", join(", ", map {length($_)?1:0} @values), "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | if ($lex) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | my $i=-1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $min; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | my $min_i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | for (@values) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ++$i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | if (defined and ((not defined $min) or ($_ lt $min))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $_ and !defined($min) || $_ lt $min
not defined $min or $_ lt $min
MC/DC0%0/3
defined $_ and !defined($min) || $_ lt $min
defined $_
not defined $min
$_ lt $min
Truth table0%0/4
A and not(B) or C
A= defined $_B= not defined $minC= $_ lt $min
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $min = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $min_i = $i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | $values[$min_i] = $iterators->[$min_i]->() if defined $min_i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | # warn "value is ", (length($min)?1:0), " from $min_i"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $min | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | return sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | my $i=-1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | my $min; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | my $min_i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | for (@values) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ++$i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if (defined and ((not defined $min) or ($_ < $min))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $_ and !defined($min) || $_ < $min
not defined $min or $_ < $min
MC/DC0%0/3
defined $_ and !defined($min) || $_ < $min
defined $_
not defined $min
$_ < $min
Truth table0%0/4
A and not(B) or C
A= defined $_B= not defined $minC= $_ < $min
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $min = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $min_i = $i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | $values[$min_i] = $iterators->[$min_i]->() if defined $min_i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | $min | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | sub _merger_generator { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 16 | ▶ | my ($nb, $lex, $globs) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_merger_generator: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 16 | my $str = "no warnings;sub{"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 16 | $str .= "my(". join(',', map {"\$i$_"} 1..$nb). ")=\@_;"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 16 | ▶ | $str .= $globs ? "my\$n$_=<\$i$_>;" : "my\$n$_=&\$i$_;" for 1..$nb; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 16 | $str .= "my\$r;sub{"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 16 | ▶ | my $cmp = $lex ? ' lt' : '<'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 16 | $str .= _cmp($cmp, $globs, 1..$nb); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 16 | $str .= ";\$r}}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | # $str =~ s/;/;\n/g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | # $str =~ s/\$/ \$/g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | # $str =~ s/{/ {\n/g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | # $str =~ s/}/ }\n/g; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | # warn "\n\n$str\n\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 16 | ▶ | eval($str) || die "$@ in $str" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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
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
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | # recursive comparison expression building | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | sub _cmp { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 2024 | ▶ | my ($cmp, $globs, $i, $j) = splice(@_, 0, 4); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cmp: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 2024 | ▶ | return $globs ? "(\$r=\$n$i,\$n$i=<\$i$i>)" : "(\$r=\$n$i,\$n$i=&\$i$i)" unless defined $j; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 1004 | "(!defined\$n$j||defined\$n$i&&\$n$i$cmp\$n$j)?". _cmp($cmp, $globs, $i, @_). ":". _cmp($cmp, $globs, $j, @_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 2 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||