| 1 | package App::ZofCMS::Plugin::DBI; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | our $VERSION = '1.001010'; # VERSION | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use DBI; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub new { bless {}, shift; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | sub process { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | my ( $self, $template, $query, $config ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | my $dbi_conf = { | ||||||||||||||||||||||||||||||||||||||||||
| 19 | do_dbi_set_first => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | %{ $config->conf->{dbi} || {} }, | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$config->conf->{'dbi'} || {}
MC/DC0%0/1
$config->conf->{'dbi'} || {}
$config->conf->{'dbi'}
Truth table0%0/2
A
A= $config->conf->{'dbi'}
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | %{ delete $template->{dbi} || {} }, | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
delete $template->{'dbi'} || {}
MC/DC0%0/1
delete $template->{'dbi'} || {}
delete $template->{'dbi'}
Truth table0%0/2
A
A= delete $template->{'dbi'}
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | $dbi_conf or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | ( $dbi_conf->{dbi_set} or $dbi_conf->{dbi_get} ) | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dbi_conf->{"dbi_set"} or $dbi_conf->{"dbi_get"}
MC/DC0%0/2
$dbi_conf->{"dbi_set"} or $dbi_conf->{"dbi_get"}
$dbi_conf->{"dbi_set"}
$dbi_conf->{"dbi_get"}
Truth table0%0/3
A or B
A= $dbi_conf->{"dbi_set"}B= $dbi_conf->{"dbi_get"}
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | my $dbh = DBI->connect_cached( | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | @$dbi_conf{ qw/dsn user pass opt/ } | |||||||||||||||||||||||||||||||||||||||||
| 30 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | if ( $dbi_conf->{do_dbi_set_first} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | if ( $dbi_conf->{dbi_set} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | $self->_do_dbi_set( $dbi_conf, $query, $template, $config, $dbh ); | |||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | if ( $dbi_conf->{dbi_get} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | $self->_do_dbi_get( $dbi_conf, $query, $template, $config, $dbh ); | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | if ( $dbi_conf->{dbi_get} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | $self->_do_dbi_get( $dbi_conf, $query, $template, $config, $dbh ); | |||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | if ( $dbi_conf->{dbi_set} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | $self->_do_dbi_set( $dbi_conf, $query, $template, $config, $dbh ); | |||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | sub _do_dbi_set { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_do_dbi_set: not called CC=12 SCAR=50.5
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my ( $self, $dbi_conf, $query, $template, $config, $dbh ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | if ( ref $dbi_conf->{dbi_set} eq 'CODE' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $dbi_conf->{"dbi_set"} eq "CODE" or not ref $dbi_conf->{"dbi_set"}[0]
MC/DC0%0/2
ref $dbi_conf->{"dbi_set"} eq "CODE" or not ref $dbi_conf->{"dbi_set"}[0]
ref $dbi_conf->{"dbi_set"} eq "CODE"
not ref $dbi_conf->{"dbi_set"}[0]
Truth table0%0/3
A or not(B)
A= ref $dbi_conf->{"dbi_set"} eq "CODE"B= not ref $dbi_conf->{"dbi_set"}[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | or not ref $dbi_conf->{dbi_set}[0] | ||||||||||||||||||||||||||||||||||||||||||
| 55 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | $dbi_conf->{dbi_set} = [ $dbi_conf->{dbi_set} ]; | |||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | for my $set ( @{ $dbi_conf->{dbi_set} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if ( ref $set eq 'CODE' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | my $sub_set_ref = $set->($query, $template, $config, $dbh ); | |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | $sub_set_ref = [ $sub_set_ref ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $sub_set_ref or ref $sub_set_ref eq "ARRAY" and ref $sub_set_ref->[0] eq "ARRAY"
ref $sub_set_ref eq "ARRAY" and ref $sub_set_ref->[0] eq "ARRAY"
MC/DC0%0/3
not $sub_set_ref or ref $sub_set_ref eq "ARRAY" and ref $sub_set_ref->[0] eq "ARRAY"
not $sub_set_ref
ref $sub_set_ref eq "ARRAY"
ref $sub_set_ref->[0] eq "ARRAY"
Truth table0%0/4
not(A) or B and C
A= not $sub_set_refB= ref $sub_set_ref eq "ARRAY"C= ref $sub_set_ref->[0] eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | unless not $sub_set_ref | ||||||||||||||||||||||||||||||||||||||||||
| 65 | or ( ref $sub_set_ref eq 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||||
| 66 | and ref $sub_set_ref->[0] eq 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||||
| 67 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | $dbh->do( @$_ ) for @{ $sub_set_ref || [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$sub_set_ref || []
MC/DC0%0/1
$sub_set_ref || []
$sub_set_ref
Truth table0%0/2
A
A= $sub_set_ref
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $dbh->do( @$set ); | |||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | if ( defined $dbi_conf->{last_insert_id} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | $dbi_conf->{last_insert_id} = [ | ||||||||||||||||||||||||||||||||||||||||||
| 76 | undef, | ||||||||||||||||||||||||||||||||||||||||||
| 77 | undef, | ||||||||||||||||||||||||||||||||||||||||||
| 78 | undef, | ||||||||||||||||||||||||||||||||||||||||||
| 79 | undef, | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | ] unless ref $dbi_conf->{last_insert_id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | $template->{d}{last_insert_id} = $dbh->last_insert_id( | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | @{ $dbi_conf->{last_insert_id} } | |||||||||||||||||||||||||||||||||||||||||
| 84 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub _do_dbi_get { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_do_dbi_get: not called CC=20 SCAR=60.4
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | my ( $self, $dbi_conf, $query, $template, $config, $dbh ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | if ( ref $dbi_conf->{dbi_get} eq 'CODE' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $dbi_conf->{dbi_get} = $dbi_conf->{dbi_get}->( | |||||||||||||||||||||||||||||||||||||||||
| 93 | $query, $template, $config, $dbh | ||||||||||||||||||||||||||||||||||||||||||
| 94 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | if ( ref $dbi_conf->{dbi_get} eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | $dbi_conf->{dbi_get} = [ $dbi_conf->{dbi_get} ]; | |||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | for my $get ( @{ $dbi_conf->{dbi_get} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | $get->{type} ||= 'loop'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$get->{"type"} ||= "loop"
MC/DC0%0/1
$get->{"type"} ||= "loop"
$get->{"type"}
Truth table0%0/2
A
A= $get->{"type"}
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | $get->{name} ||= 'dbi_var'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$get->{"name"} ||= "dbi_var"
MC/DC0%0/1
$get->{"name"} ||= "dbi_var"
$get->{"name"}
Truth table0%0/2
A
A= $get->{"name"}
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | $get->{method} ||= 'selectall'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$get->{"method"} ||= "selectall"
MC/DC0%0/1
$get->{"method"} ||= "selectall"
$get->{"method"}
Truth table0%0/2
A
A= $get->{"method"}
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | $get->{cell} ||= 't'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$get->{"cell"} ||= "t"
MC/DC0%0/1
$get->{"cell"} ||= "t"
$get->{"cell"}
Truth table0%0/2
A
A= $get->{"cell"}
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if ( $get->{type} eq 'loop' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my $data_ref; | |||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | if ( $get->{method} eq 'selectall' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | $data_ref = $dbh->selectall_arrayref( | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | @{ $get->{sql} }, | |||||||||||||||||||||||||||||||||||||||||
| 112 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | if ( $get->{process} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $get->{process}->( $data_ref, $template, $query, $config ); | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | my $is_hash = ${ $get->{sql} || []}[1]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$get->{'sql'} || []
MC/DC0%0/1
$get->{'sql'} || []
$get->{'sql'}
Truth table0%0/2
A
A= $get->{'sql'}
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | $is_hash = ref $is_hash->{Slice} eq 'HASH' ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | if ( $get->{single} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | my $loop_ref = $self->_prepare_loop_arrayref( | ||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | $data_ref, $get->{layout}, $is_hash | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->_prepare_loop_arrayref($data_ref, $get->{'layout'}, $is_hash)->[0] || {}
MC/DC0%0/1
$self->_prepare_loop_arrayref($data_ref, $get->{'layout'}, $is_hash)->[0] || {}
$self->_prepare_loop_arrayref($data_ref, $get->{'layout'}, $is_hash)->[0]
Truth table0%0/2
A
A= $self->_prepare_loop_arrayref($data_ref, $get->{'layout'}, $is_hash)->[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | )->[0] || {}; | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | if ( defined $get->{single_prefix} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | my $pre = $get->{single_prefix}; | |||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | $loop_ref->{"$pre$_"} | ||||||||||||||||||||||||||||||||||||||||||
| 131 | = delete $loop_ref->{$_} | ||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | for keys %$loop_ref; | |||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | $template->{ $get->{cell} } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | = { | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | %{ $template->{ $get->{cell} } || {} }, | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$template{$get->{'cell'}} || {}
MC/DC0%0/1
$$template{$get->{'cell'}} || {}
$$template{$get->{'cell'}}
Truth table0%0/2
A
A= $$template{$get->{'cell'}}
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | %$loop_ref, | ||||||||||||||||||||||||||||||||||||||||||
| 139 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 142 | $template->{ $get->{cell} }{ $get->{name} } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | = $self->_prepare_loop_arrayref( | ||||||||||||||||||||||||||||||||||||||||||
| 144 | $data_ref, | ||||||||||||||||||||||||||||||||||||||||||
| 145 | $get->{layout}, | ||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $is_hash, | |||||||||||||||||||||||||||||||||||||||||
| 147 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | if ( $get->{on_data} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | $template->{t}{ $get->{on_data} } = 1 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | if @$data_ref; | ||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | sub _prepare_loop_arrayref { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_prepare_loop_arrayref: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my ( $self, $data_ref, $layout_ref, $is_hash ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my @loop; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | for my $entry_ref ( @$data_ref ) { | |||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | if ( $is_hash ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if ( defined $layout_ref ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | @{ $entry_ref = {} }{ @$layout_ref } = @$entry_ref{ @$layout_ref }; | |||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | push @loop, $entry_ref; | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | push @loop, { | |||||||||||||||||||||||||||||||||||||||||
| 172 | map +( | ||||||||||||||||||||||||||||||||||||||||||
| 173 | $layout_ref->[$_] => $entry_ref->[$_] | ||||||||||||||||||||||||||||||||||||||||||
| 174 | ), 0 .. $#$entry_ref | ||||||||||||||||||||||||||||||||||||||||||
| 175 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | return \@loop; | |||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 184 | __END__ | ||||||||||||||||||||||||||||||||||||||||||