| 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
| |||||||||||||||||||||||||||||
| 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
Condition100%3/3
$method eq "do" or exists $DBIx::Roles::DBI_select_methods{$method}
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}
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 30 | 5 | ▶ | splice( @$params, $shift, $#$params, inline( @$params[ $shift..$#$params ])) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | if $shift < @$params; | ||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 12 | return $self-> super( $method, $params); | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 1 | 1; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | __DATA__ | ||||||||||||||||||||||||||||