Roles/InlineArray.pm

filter: Statementstmt 100% 15 / 15 Branchbran 87.5% 7 / 8 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 2 totaltotal 91.1% 31 / 34 CC 6 SCAR 12.4
CC
6
Cov
96%
rewrite
5.0
inline
2.0
BEGIN
1.0
CRAP 3.4
« Roles.pm ↑ Summary Roles/Hook.pm »
1 # $Id: InlineArray.pm,v 1.4 2005/11/30 13:13:37 dk Exp $
2  
3 # recursively straightens array references into {,,}-strings
4 # useful for DBD implementations that cannot do that themselves
5  
6 package DBIx::Roles::InlineArray;
7  
8 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 $VERSION = '1.00';
12  
13 sub inline
14 4 ▶{
Subroutine inline: called CC=2 SCAR=6.9
Pod undocumented
15 map {
16 4 ▶ ref($_) ?
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 1 6 7
17 '{' . join(',', inline(@$_)) . '}' :
18 $_
19 } @_
20 }
21  
22 sub rewrite
23 12 ▶{
Subroutine rewrite: called CC=5 SCAR=16.1
Pod undocumented
24 12 my ( $self, $storage, $method, $params) = @_;
25 12 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($method eq "do" or exists $DBIx::Roles::DBI_select_methods{$method}) 5 7 12
Condition100%3/3
$method eq "do" or exists $DBIx::Roles::DBI_select_methods{$method}
l!l&&r!l&&!r
417
MC/DC100%2/2
$method eq "do" or exists $DBIx::Roles::DBI_select_methods{$method}
$method eq "do" exists $DBIx::Roles::DBI_select_methods{$method}
Truth table100%3/3
A or B
A= $method eq "do"B= exists $DBIx::Roles::DBI_select_methods{$method}
ABresult
1X1
011
000
26 $method eq 'do' or
27 exists $DBIx::Roles::DBI_select_methods{$method}
28 ) {
29 5 ▶ my $shift = ( $method eq 'selectall_hashref') ? 3 : 2;
Branch: 1 branch
BranchTrueFalseTotal
$method eq 'selectall_hashref' ? : 0 5 5
30 5 ▶ splice( @$params, $shift, $#$params, inline( @$params[ $shift..$#$params ]))
Branch: 1 branch
BranchTrueFalseTotal
if $shift < @$params 3 2 5
31 if $shift < @$params;
32 }
33  
34 12 return $self-> super( $method, $params);
35 }
36  
37 1 1;
38  
39 __DATA__
« Roles.pm ↑ Summary Roles/Hook.pm »