DBIx/Class/_Util.pm

filter: Statementstmt 65.0% 104 / 160 Branchbran 41.0% 41 / 100 Conditioncond 19.6% 10 / 51 MC/DCmcdc 0.0% 0 / 32 Subroutinesub 84.8% 28 / 33 Podpod 0.0% 0 / 14 totaltotal 46.9% 183 / 390 CC 70 SCAR 34.6
CC
70
Cov
50%
emit_loud_diag
156.0
fail_on_internal_wantarray
72.0
fail_on_internal_call
28.3
CRAP 31.8
« DBIx/Class/Storage/DBI/UniqueIdentifier.pm ↑ Summary DBIx/Class/Storage/DBI/Firebird/Common.pm »
1 package # hide from PAUSE
2 DBIx::Class::_Util;
3  
4 388 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 388 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 388 ▶use constant SPURIOUS_VERSION_CHECK_WARNINGS => (
Subroutine BEGIN: called CC=3 SCAR=12.5
8 388 ▶ ( $ENV{DBICTEST_VERSION_WARNS_INDISCRIMINATELY} or $] < 5.010 )
Branch: 1 branch
BranchTrueFalseTotal
$ENV{'DBICTEST_VERSION_WARNS_INDISCRIMINATELY'} || $] < 5.01 ? : 0 388 388
Condition33%1/3
$ENV{"DBICTEST_VERSION_WARNS_INDISCRIMINATELY"} or $] < "5.01"
l!l&&r!l&&!r
00388
MC/DC0%0/2
$ENV{"DBICTEST_VERSION_WARNS_INDISCRIMINATELY"} or $] < "5.01"
$ENV{"DBICTEST_VERSION_WARNS_INDISCRIMINATELY"} $] < "5.01"
Truth table33%1/3
A or B
A= $ENV{"DBICTEST_VERSION_WARNS_INDISCRIMINATELY"}B= $] < "5.01"
ABresult
1X1
011
000
9 ? 1
10 : 0
11 388 );
12  
13 388 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=8.3
14 package # hide from pause
15 DBIx::Class::_ENV_;
16  
17 388 ▶ use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 388 ▶ use constant {
Subroutine BEGIN: called CC=12 SCAR=32.7
20  
21 # but of course
22 BROKEN_FORK => ($^O eq 'MSWin32') ? 1 : 0,
23  
24 BROKEN_GOTO => ($] < '5.008003') ? 1 : 0,
25  
26 HAS_ITHREADS => $Config{useithreads} ? 1 : 0,
27  
28 UNSTABLE_DOLLARAT => ( "$]" < 5.013002 ) ? 1 : 0,
29  
30 DBICTEST => $INC{"DBICTest/Util.pm"} ? 1 : 0,
31  
32 # During 5.13 dev cycle HELEMs started to leak on copy
33 # add an escape for these perls ON SMOKERS - a user will still get death
34 388 ▶ PEEPEENESS => ( eval { DBICTest::RunMode->is_smoker } && ($] >= 5.013005 and $] <= 5.013006) ),
Branch: 4 branches
BranchTrueFalseTotal
$ENV{'DBIC_SHUFFLE_UNORDERED_RESULTSETS'} ? : 0 388 388
$ENV{'DBIC_ASSERT_NO_INTERNAL_WANTARRAY'} ? : 0 388 388
$ENV{'DBIC_ASSERT_NO_INTERNAL_INDIRECT_CALLS'} ? : 0 388 388
$ENV{'DBIC_STRESSTEST_UTF8_UPGRADE_GENERATED_COLLAPSER_SOURCE'} ? : 0 388 388
Condition0%0/3
$] >= "5.013005" and $] <= "5.013006"
!ll&&!rl&&r
000
MC/DC0%0/2
$] >= "5.013005" and $] <= "5.013006"
$] >= "5.013005" $] <= "5.013006"
Truth table0%0/3
A and B
A= $] >= "5.013005"B= $] <= "5.013006"
ABresult
0X0
100
111
35  
36 SHUFFLE_UNORDERED_RESULTSETS => $ENV{DBIC_SHUFFLE_UNORDERED_RESULTSETS} ? 1 : 0,
37  
38 ASSERT_NO_INTERNAL_WANTARRAY => $ENV{DBIC_ASSERT_NO_INTERNAL_WANTARRAY} ? 1 : 0,
39  
40 ASSERT_NO_INTERNAL_INDIRECT_CALLS => $ENV{DBIC_ASSERT_NO_INTERNAL_INDIRECT_CALLS} ? 1 : 0,
41  
42 STRESSTEST_UTF8_UPGRADE_GENERATED_COLLAPSER_SOURCE => $ENV{DBIC_STRESSTEST_UTF8_UPGRADE_GENERATED_COLLAPSER_SOURCE} ? 1 : 0,
43  
44 IV_SIZE => $Config{ivsize},
45  
46 388 ▶ OS_NAME => $^O,
Branch: 5 branches
BranchTrueFalseTotal
$^O eq 'MSWin32' ? : 0 388 388
$] < 5.008003 ? : 0 388 388
$DBIx::Class::_ENV_::Config{'useithreads'} ? : 0 388 388
"$]" < 5.013002 ? : 0 388 388
$INC{'DBICTest/Util.pm'} ? : 325 63 388
Condition33%1/3
eval { do { 'DBICTest::RunMode'->is_smoker } } && ($] >= 5.013005 && $] <= 5.013006)
!ll&&!rl&&r
38800
MC/DC0%0/2
eval { do { 'DBICTest::RunMode'->is_smoker } } && ($] >= 5.013005 && $] <= 5.013006)
eval { do { 'DBICTest::RunMode'->is_smoker } } ($] >= 5.013005 && $] <= 5.013006)
Truth table33%1/3
A && B
A= eval { do { 'DBICTest::RunMode'->is_smoker } }B= ($] >= 5.013005 && $] <= 5.013006)
ABresult
0X0
100
111
47 388 };
48  
49 388 ▶ if ($] < 5.009_005) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.009005) { } 0 388 388
50 0 require MRO::Compat;
51 0 constant->import( OLD_MRO => 1 );
52 }
53 else {
54 388 require mro;
55 388 constant->import( OLD_MRO => 0 );
56 }
57 }
58  
59 # FIXME - this is not supposed to be here
60 # Carp::Skip to the rescue soon
61 388 ▶use DBIx::Class::Carp '^DBIx::Class|^DBICTest';
Subroutine BEGIN: called CC=1 SCAR=0.0
62  
63 388 ▶use B ();
Subroutine BEGIN: called CC=1 SCAR=0.0
64 388 ▶use Carp 'croak';
Subroutine BEGIN: called CC=1 SCAR=0.0
65 388 ▶use Storable 'nfreeze';
Subroutine BEGIN: called CC=1 SCAR=0.0
66 388 ▶use Scalar::Util qw(weaken blessed reftype refaddr);
Subroutine BEGIN: called CC=1 SCAR=0.0
67 388 ▶use Sub::Quote qw(qsub quote_sub);
Subroutine BEGIN: called CC=1 SCAR=0.0
68  
69 388 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
70 388 our @EXPORT_OK = qw(
71 sigwarn_silencer modver_gt_or_eq modver_gt_or_eq_and_lt
72 fail_on_internal_wantarray fail_on_internal_call
73 refdesc refcount hrefaddr
74 scope_guard is_exception detected_reinvoked_destructor emit_loud_diag
75 quote_sub qsub perlstring serialize
76 UNRESOLVABLE_CONDITION
77 );
78  
79 388 ▶use constant UNRESOLVABLE_CONDITION => \ '1 = 0';
Subroutine BEGIN: called CC=1 SCAR=0.0
80  
81 97 ▶sub sigwarn_silencer ($) {
Subroutine sigwarn_silencer: called CC=3 SCAR=11.8
Pod undocumented
82 97 my $pattern = shift;
83  
84 97 ▶ croak "Expecting a regexp" if ref $pattern ne 'Regexp';
Branch: 1 branch
BranchTrueFalseTotal
if ref $pattern ne "Regexp" 0 97 97
85  
86 0 ▶ my $orig_sig_warn = $SIG{__WARN__} || sub { CORE::warn(@_) };
Subroutine __ANON__: not called CC=1 SCAR=0.6
Condition66%2/3
$SIG{'__WARN__'} || sub { warn @_; }
l!l&&r!l&&!r
7900
MC/DC0%0/2
$SIG{'__WARN__'} || sub { warn @_; }
$SIG{'__WARN__'} sub { warn @_; }
Truth table66%2/3
A || B
A= $SIG{'__WARN__'}B= sub { warn @_; }
ABresult
1X1
011
000
87  
88 97 ▶ return sub { &$orig_sig_warn unless $_[0] =~ $pattern };
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0] =~ /$pattern/ 0 23 23
89 }
90  
91 31254 ▶sub perlstring ($) { q{"}. quotemeta( shift ). q{"} };
Subroutine perlstring: called CC=1 SCAR=0.0
Pod undocumented
92  
93 52486 ▶sub hrefaddr ($) { sprintf '0x%x', &refaddr||0 }
Subroutine hrefaddr: called CC=2 SCAR=7.6
Pod undocumented
Condition50%1/2
&refaddr || 0
l!l
524860
MC/DC0%0/1
&refaddr || 0
&refaddr
Truth table50%1/2
A
A= &refaddr
Aresult
11
00
94  
95 6929 ▶sub refdesc ($) {
Subroutine refdesc: called CC=3 SCAR=11.1
Pod undocumented
96 6929 ▶ croak "Expecting a reference" if ! length ref $_[0];
Branch: 1 branch
BranchTrueFalseTotal
unless length ref $_[0] 0 6929 6929
97  
98 # be careful not to trigger stringification,
99 # reuse @_ as a scratch-pad
100 6929 ▶ sprintf '%s%s(0x%x)',
Branch: 1 branch
BranchTrueFalseTotal
defined($_[1] = builtin::blessed($_[0])) ? : 4728 2201 6929
101 ( defined( $_[1] = blessed $_[0]) ? "$_[1]=" : '' ),
102 reftype $_[0],
103 refaddr($_[0]),
104 ;
105 }
106  
107 38941 ▶sub refcount ($) {
Subroutine refcount: called CC=2 SCAR=7.2
Pod undocumented
108 38941 ▶ croak "Expecting a reference" if ! length ref $_[0];
Branch: 1 branch
BranchTrueFalseTotal
unless length ref $_[0] 0 38941 38941
109  
110 # No tempvars - must operate on $_[0], otherwise the pad
111 # will count as an extra ref
112 38941 B::svref_2object($_[0])->REFCNT;
113 }
114  
115 9507 ▶sub serialize ($) {
Subroutine serialize: called CC=1 SCAR=0.0
Pod undocumented
116 9507 local $Storable::canonical = 1;
117 9507 nfreeze($_[0]);
118 }
119  
120  
121 388 my $seen_loud_screams;
122 0 ▶sub emit_loud_diag {
Subroutine emit_loud_diag: not called CC=12 SCAR=50.5
Pod undocumented
123 0 ▶ my $args = { ref $_[0] eq 'HASH' ? %{$_[0]} : @_ };
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 0 0
124  
125 0 ▶ unless ( defined $args->{msg} and length $args->{msg} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $args->{"msg"} and length $args->{"msg"}) 0 0 0
Condition0%0/3
defined $args->{"msg"} and length $args->{"msg"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $args->{"msg"} and length $args->{"msg"}
defined $args->{"msg"} length $args->{"msg"}
Truth table0%0/3
A and B
A= defined $args->{"msg"}B= length $args->{"msg"}
ABresult
0X0
100
111
126 0 emit_loud_diag(
127 msg => "No 'msg' value supplied to emit_loud_diag()"
128 );
129 0 exit 70;
130 }
131  
132 my $msg = "\n" . join( ': ',
133 ( $0 eq '-e' ? () : $0 ),
134 $args->{msg}
135 0 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$0 eq '-e' ? : 0 0 0
136  
137 # when we die - we usually want to keep doing it
138 $args->{emit_dups} = !!$args->{confess}
139 0 ▶ unless exists $args->{emit_dups};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $args->{"emit_dups"} 0 0 0
140  
141 local $Carp::CarpLevel =
142 0 ▶ ( $args->{skip_frames} || 0 )
Condition0%0/2
$args->{'skip_frames'} || 0
l!l
00
MC/DC0%0/1
$args->{'skip_frames'} || 0
$args->{'skip_frames'}
Truth table0%0/2
A
A= $args->{'skip_frames'}
Aresult
11
00
143 +
144 $Carp::CarpLevel
145 +
146 # hide our own frame
147 1
148 ;
149  
150 0 my $longmess = Carp::longmess();
151  
152 # different object references will thwart deduplication without this
153 0 ( my $key = "${msg}\n${longmess}" ) =~ s/\b0x[0-9a-f]+\b/0x.../gi;
154  
155 return $seen_loud_screams->{$key} if
156 $seen_loud_screams->{$key}++
157 and
158 ! $args->{emit_dups}
159 0 ▶ ;
Branch: 1 branch
BranchTrueFalseTotal
if $seen_loud_screams->{$key}++ and not $args->{"emit_dups"} 0 0 0
Condition0%0/3
$seen_loud_screams->{$key}++ and not $args->{"emit_dups"}
!ll&&!rl&&r
000
MC/DC0%0/2
$seen_loud_screams->{$key}++ and not $args->{"emit_dups"}
$seen_loud_screams->{$key}++ not $args->{"emit_dups"}
Truth table0%0/3
A and not(B)
A= $seen_loud_screams->{$key}++B= not $args->{"emit_dups"}
ABresult
0X0
100
111
160  
161 0 ▶ $msg .= $longmess
Branch: 1 branch
BranchTrueFalseTotal
unless $msg =~ /\n\z/ 0 0 0
162 unless $msg =~ /\n\z/;
163  
164 0 ▶ print STDERR "$msg\n"
Branch: 1 branch
BranchTrueFalseTotal
print STDERR "$msg\n" or print STDOUT "\n!!!STDERR ISN'T WRITABLE!!!:$msg\n" 0 0 0
165 or
166 print STDOUT "\n!!!STDERR ISN'T WRITABLE!!!:$msg\n";
167  
168 return $seen_loud_screams->{$key}
169 0 ▶ unless $args->{confess};
Branch: 1 branch
BranchTrueFalseTotal
unless $args->{"confess"} 0 0 0
170  
171 # increment *again*, because... Carp.
172 0 $Carp::CarpLevel++;
173 # not $msg - Carp will reapply the longmess on its own
174 0 Carp::confess($args->{msg});
175 }
176  
177  
178 11 ▶sub scope_guard (&) {
Subroutine scope_guard: called CC=2 SCAR=7.2
Pod undocumented
179 11 ▶ croak 'Calling scope_guard() in void context makes no sense'
Branch: 1 branch
BranchTrueFalseTotal
unless defined wantarray 0 11 11
180 if ! defined wantarray;
181  
182 # no direct blessing of coderefs - DESTROY is buggy on those
183 11 bless [ $_[0] ], 'DBIx::Class::_Util::ScopeGuard';
184 }
185 {
186 package #
187 DBIx::Class::_Util::ScopeGuard;
188  
189 11 ▶ sub DESTROY {
Subroutine DESTROY: called CC=2 SCAR=7.2
190 11 &DBIx::Class::_Util::detected_reinvoked_destructor;
191  
192 11 local $@ if DBIx::Class::_ENV_::UNSTABLE_DOLLARAT;
193  
194 eval {
195 11 $_[0]->[0]->();
196 11 1;
197 11 ▶ } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $_[0][0]->(); 1 } } or do { Carp::cluck("Execution of scope guard $_[0] resulted in the non-trappable exception:\n\n$@") } 11 0 11
198 0 Carp::cluck "Execution of scope guard $_[0] resulted in the non-trappable exception:\n\n$@";
199 };
200 }
201 }
202  
203 388 ▶sub is_exception ($) {
Subroutine is_exception: called CC=7 SCAR=19.7
Pod undocumented
204 54129 my $e = $_[0];
205  
206 # this is not strictly correct - an eval setting $@ to undef
207 # is *not* the same as an eval setting $@ to ''
208 # but for the sake of simplicity assume the following for
209 # the time being
210 54129 ▶ return 0 unless defined $e;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $e 0 54129 54129
211  
212 54129 my ($not_blank, $suberror);
213 {
214 54129 local $@;
215 54129 ▶ eval {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $not_blank = $e ne "" ? 1 : 0; 1 } } or $suberror = $@ 54127 2 54129
216 54129 ▶ $not_blank = ($e ne '') ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$e ne '' ? : 993 53134 54127
217 54127 1;
218 } or $suberror = $@;
219 }
220  
221 54129 ▶ if (defined $suberror) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $suberror) 2 54127 54129
222 2 ▶ if (length (my $class = blessed($e) )) {
Branch: 1 branch
BranchTrueFalseTotal
if (length(my $class = builtin::blessed($e))) { } 2 0 2
223 2 carp_unique( sprintf(
224 'External exception class %s implements partial (broken) overloading '
225 . 'preventing its instances from being used in simple ($x eq $y) '
226 . 'comparisons. Given Perl\'s "globally cooperative" exception '
227 . 'handling this type of brokenness is extremely dangerous on '
228 . 'exception objects, as it may (and often does) result in silent '
229 . '"exception substitution". DBIx::Class tries to work around this '
230 . 'as much as possible, but other parts of your software stack may '
231 . 'not be even aware of this. Please submit a bugreport against the '
232 . 'distribution containing %s and in the meantime apply a fix similar '
233 . 'to the one shown at %s, in order to ensure your exception handling '
234 . 'is saner application-wide. What follows is the actual error text '
235 . "as generated by Perl itself:\n\n%s\n ",
236 $class,
237 $class,
238 'http://v.gd/DBIC_overload_tempfix/',
239 $suberror,
240 ));
241  
242 # workaround, keeps spice flowing
243 2 ▶ $not_blank = ("$e" ne '') ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
"$e" ne '' ? : 2 0 2
244 }
245 else {
246 # not blessed yet failed the 'ne'... this makes 0 sense...
247 # just throw further
248 0 die $suberror
249 }
250 }
251  
252 54129 return $not_blank;
253 }
254  
255 {
256 388 my $destruction_registry = {};
257  
258 0 ▶ sub CLONE {
Subroutine CLONE: not called CC=2 SCAR=17.9
259 $destruction_registry = { map
260 0 ▶ { defined $_ ? ( refaddr($_) => $_ ) : () }
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
261 values %$destruction_registry
262 };
263 }
264  
265 # This is almost invariably invoked from within DESTROY
266 # throwing exceptions won't work
267 59867 ▶ sub detected_reinvoked_destructor {
Subroutine detected_reinvoked_destructor: called CC=7 SCAR=24.0
Pod undocumented
268  
269 # quick "garbage collection" pass - prevents the registry
270 # from slowly growing with a bunch of undef-valued keys
271 defined $destruction_registry->{$_} or delete $destruction_registry->{$_}
272 59867 ▶ for keys %$destruction_registry;
Branch: 1 branch
BranchTrueFalseTotal
defined $destruction_registry->{$_} or delete $destruction_registry->{$_} 67 59533 59600
273  
274 59867 ▶ if (! length ref $_[0]) {
Branch: 2 branches
BranchTrueFalseTotal
if (not length ref $_[0]) { } 0 59867 59867
elsif (not defined $$destruction_registry{my $addr = builtin::refaddr($_[0])}) { } 59866 1 59867
275 0 printf STDERR '%s() expects a blessed reference %s',
276 (caller(0))[3],
277 Carp::longmess,
278 ;
279 0 return undef; # don't know wtf to do
280 }
281 elsif (! defined $destruction_registry->{ my $addr = refaddr($_[0]) } ) {
282 59866 weaken( $destruction_registry->{$addr} = $_[0] );
283 59866 return 0;
284 }
285 else {
286 carp_unique ( sprintf (
287 'Preventing *MULTIPLE* DESTROY() invocations on %s - an *EXTREMELY '
288 . 'DANGEROUS* condition which is *ALMOST CERTAINLY GLOBAL* within your '
289 . 'application, affecting *ALL* classes without active protection against '
290 . 'this. Diagnose and fix the root cause ASAP!!!%s',
291 refdesc $_[0],
292 0 ▶ ( ( $INC{'Devel/StackTrace.pm'} and ! do { local $@; eval { Devel::StackTrace->VERSION(2) } } )
Branch: 1 branch
BranchTrueFalseTotal
$INC{'Devel/StackTrace.pm'} && !do { local $@; eval { do { 'Devel::StackTrace'->VERSION(2) } } } ? : 0 1 1
Condition33%1/3
$INC{"Devel/StackTrace.pm"} and not do { local $@; eval { do { "Devel::StackTrace"->VERSION(2) } } }
!ll&&!rl&&r
100
MC/DC0%0/2
$INC{"Devel/StackTrace.pm"} and not do { local $@; eval { do { "Devel::StackTrace"->VERSION(2) } } }
$INC{"Devel/StackTrace.pm"} not do { local $@; eval { do { "Devel::StackTrace"->VERSION(2) } } }
Truth table33%1/3
A and not(B)
A= $INC{"Devel/StackTrace.pm"}B= not do { local $@; eval { do { "Devel::StackTrace"->VERSION(2) } } }
ABresult
0X0
100
111
293 0 ? " (likely culprit Devel::StackTrace\@@{[ Devel::StackTrace->VERSION ]} found in %INC, http://is.gd/D_ST_refcap)"
294 : ''
295 )
296 ));
297  
298 1 return 1;
299 }
300 }
301 }
302  
303 388 ▶sub modver_gt_or_eq ($$) {
Subroutine modver_gt_or_eq: called CC=7 SCAR=22.0
Pod undocumented
304 254 my ($mod, $ver) = @_;
305  
306 254 ▶ croak "Nonsensical module name supplied"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $mod and length $mod 0 254 254
Condition33%1/3
defined $mod and length $mod
!ll&&!rl&&r
00254
MC/DC0%0/2
defined $mod and length $mod
defined $mod length $mod
Truth table33%1/3
A and B
A= defined $modB= length $mod
ABresult
0X0
100
111
307 if ! defined $mod or ! length $mod;
308  
309 254 ▶ croak "Nonsensical minimum version supplied"
Branch: 1 branch
BranchTrueFalseTotal
if not defined $ver or $ver =~ /[^0-9\.\_]/ 0 254 254
Condition33%1/3
not defined $ver or $ver =~ /[^0-9\.\_]/
l!l&&r!l&&!r
00254
MC/DC0%0/2
not defined $ver or $ver =~ /[^0-9\.\_]/
not defined $ver $ver =~ /[^0-9\.\_]/
Truth table33%1/3
not(A) or B
A= not defined $verB= $ver =~ /[^0-9\.\_]/
ABresult
1X1
011
000
310 if ! defined $ver or $ver =~ /[^0-9\.\_]/;
311  
312 254 local $SIG{__WARN__} = sigwarn_silencer( qr/\Qisn't numeric in subroutine entry/ )
313 if SPURIOUS_VERSION_CHECK_WARNINGS;
314  
315 254 ▶ croak "$mod does not seem to provide a version (perhaps it never loaded)"
Branch: 1 branch
BranchTrueFalseTotal
unless $mod->VERSION 0 254 254
316 unless $mod->VERSION;
317  
318 254 local $@;
319 254 ▶ eval { $mod->VERSION($ver) } ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $mod->VERSION($ver) } } ? : 254 0 254
320 }
321  
322 3 ▶sub modver_gt_or_eq_and_lt ($$$) {
Subroutine modver_gt_or_eq_and_lt: called CC=5 SCAR=20.1
Pod undocumented
323 3 my ($mod, $v_ge, $v_lt) = @_;
324  
325 3 ▶ croak "Nonsensical maximum version supplied"
Branch: 1 branch
BranchTrueFalseTotal
if not defined $v_lt or $v_lt =~ /[^0-9\.\_]/ 0 3 3
Condition33%1/3
not defined $v_lt or $v_lt =~ /[^0-9\.\_]/
l!l&&r!l&&!r
003
MC/DC0%0/2
not defined $v_lt or $v_lt =~ /[^0-9\.\_]/
not defined $v_lt $v_lt =~ /[^0-9\.\_]/
Truth table33%1/3
not(A) or B
A= not defined $v_ltB= $v_lt =~ /[^0-9\.\_]/
ABresult
1X1
011
000
326 if ! defined $v_lt or $v_lt =~ /[^0-9\.\_]/;
327  
328 return (
329 3 ▶ modver_gt_or_eq($mod, $v_ge)
Branch: 1 branch
BranchTrueFalseTotal
&modver_gt_or_eq($mod, $v_ge) && !&modver_gt_or_eq($mod, $v_lt) ? : 0 3 3
Condition33%1/3
&modver_gt_or_eq($mod, $v_ge) and not &modver_gt_or_eq($mod, $v_lt)
!ll&&!rl&&r
030
MC/DC0%0/2
&modver_gt_or_eq($mod, $v_ge) and not &modver_gt_or_eq($mod, $v_lt)
&modver_gt_or_eq($mod, $v_ge) not &modver_gt_or_eq($mod, $v_lt)
Truth table33%1/3
A and not(B)
A= &modver_gt_or_eq($mod, $v_ge)B= not &modver_gt_or_eq($mod, $v_lt)
ABresult
0X0
100
111
330 and
331 ! modver_gt_or_eq($mod, $v_lt)
332 ) ? 1 : 0;
333 }
334  
335 {
336 388 my $list_ctx_ok_stack_marker;
337  
338 0 ▶ sub fail_on_internal_wantarray () {
Subroutine fail_on_internal_wantarray: not called CC=8 SCAR=42.8
Pod undocumented
339 0 ▶ return if $list_ctx_ok_stack_marker;
Branch: 1 branch
BranchTrueFalseTotal
if $list_ctx_ok_stack_marker 0 0 0
340  
341 0 ▶ if (! defined wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined wantarray) 0 0 0
342 0 croak('fail_on_internal_wantarray() needs a tempvar to save the stack marker guard');
343 }
344  
345 0 my $cf = 1;
346 0 ▶ while ( ( (caller($cf+1))[3] || '' ) =~ / :: (?:
Branch: 1 branch
BranchTrueFalseTotal
if (((caller $cf + 1)[3] || "") =~ / :: (?: # these are public API parts that alter behavior on wantarray search | search_related | slice | search_literal | # these are explicitly prefixed, since we only recognize them as valid # escapes when they come from the guts of CDBICompat CDBICompat .*? :: (?: search_where | retrieve_from_sql | retrieve_all ) ) $/x) 0 0 0
Condition0%0/2
(caller $cf + 1)[3] || ''
l!l
00
MC/DC0%0/1
(caller $cf + 1)[3] || ''
(caller $cf + 1)[3]
Truth table0%0/2
A
A= (caller $cf + 1)[3]
Aresult
11
00
347  
348 # these are public API parts that alter behavior on wantarray
349 search | search_related | slice | search_literal
350  
351 |
352  
353 # these are explicitly prefixed, since we only recognize them as valid
354 # escapes when they come from the guts of CDBICompat
355 CDBICompat .*? :: (?: search_where | retrieve_from_sql | retrieve_all )
356  
357 ) $/x ) {
358 0 $cf++;
359 }
360  
361 0 my ($fr, $want, $argdesc);
362 {
363 0 package DB;
364 0 $fr = [ caller($cf) ];
365 0 $want = ( caller($cf-1) )[5];
366 0 ▶ $argdesc = ref $DB::args[0]
Branch: 1 branch
BranchTrueFalseTotal
ref $DB::args[0] ? : 0 0 0
367 ? DBIx::Class::_Util::refdesc($DB::args[0])
368 : 'non '
369 ;
370 };
371  
372 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($want and $fr->[0] =~ /^(?:DBIx::Class|DBICx::)/) 0 0 0
Condition0%0/3
$want and $fr->[0] =~ /^(?:DBIx::Class|DBICx::)/
!ll&&!rl&&r
000
MC/DC0%0/2
$want and $fr->[0] =~ /^(?:DBIx::Class|DBICx::)/
$want $fr->[0] =~ /^(?:DBIx::Class|DBICx::)/
Truth table0%0/3
A and B
A= $wantB= $fr->[0] =~ /^(?:DBIx::Class|DBICx::)/
ABresult
0X0
100
111
373 $want and $fr->[0] =~ /^(?:DBIx::Class|DBICx::)/
374 ) {
375 DBIx::Class::Exception->throw( sprintf (
376 "Improper use of %s instance in list context at %s line %d\n\n Stacktrace starts",
377 0 $argdesc, @{$fr}[1,2]
378 ), 'with_stacktrace');
379 }
380  
381 0 my $mark = [];
382 0 weaken ( $list_ctx_ok_stack_marker = $mark );
383 0 $mark;
384 }
385 }
386  
387 388 ▶sub fail_on_internal_call {
Subroutine fail_on_internal_call: not called CC=6 SCAR=33.4
Pod undocumented
388 0 my ($fr, $argdesc);
389 {
390 0 package DB;
391 0 $fr = [ caller(1) ];
392 0 ▶ $argdesc = ref $DB::args[0]
Branch: 1 branch
BranchTrueFalseTotal
ref $DB::args[0] ? : 0 0 0
393 ? DBIx::Class::_Util::refdesc($DB::args[0])
394 : undef
395 ;
396 };
397  
398 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($argdesc and $fr->[0] =~ /^(?:DBIx::Class|DBICx::)/ and not $fr->[1] =~ /\b(?:CDBICompat|ResultSetProxy)\b/) 0 0 0
Condition0%0/6
$argdesc and $fr->[0] =~ /^(?:DBIx::Class|DBICx::)/ and not $fr->[1] =~ /\b(?:CDBICompat|ResultSetProxy)\b/
!ll&&!rl&&r
000
$argdesc and $fr->[0] =~ /^(?:DBIx::Class|DBICx::)/
!ll&&!rl&&r
000
MC/DC0%0/3
$argdesc and $fr->[0] =~ /^(?:DBIx::Class|DBICx::)/ and not $fr->[1] =~ /\b(?:CDBICompat|ResultSetProxy)\b/
$argdesc $fr->[0] =~ /^(?:DBIx::Class|DBICx::)/ not $fr->[1] =~ /\b(?:CDBICompat|ResultSetProxy)\b/
Truth table0%0/4
A and B and not(C)
A= $argdescB= $fr->[0] =~ /^(?:DBIx::Class|DBICx::)/C= not $fr->[1] =~ /\b(?:CDBICompat|ResultSetProxy)\b/
ABCresult
0XX0
10X0
1100
1111
399 $argdesc
400 and
401 $fr->[0] =~ /^(?:DBIx::Class|DBICx::)/
402 and
403 $fr->[1] !~ /\b(?:CDBICompat|ResultSetProxy)\b/ # no point touching there
404 ) {
405 DBIx::Class::Exception->throw( sprintf (
406 "Illegal internal call of indirect proxy-method %s() with argument %s: examine the last lines of the proxy method deparse below to determine what to call directly instead at %s on line %d\n\n%s\n\n Stacktrace starts",
407 0 ▶ $fr->[3], $argdesc, @{$fr}[1,2], ( $fr->[6] || do {
Condition0%0/3
$fr->[6] || do { require B::Deparse; no strict 'refs'; 'B::Deparse'->new->coderef2text(\&{$fr->[3];}) }
l!l&&r!l&&!r
000
MC/DC0%0/2
$fr->[6] || do { require B::Deparse; no strict 'refs'; 'B::Deparse'->new->coderef2text(\&{$fr->[3];}) }
$fr->[6] do { require B::Deparse; no strict 'refs'; 'B::Deparse'->new->coderef2text(\&{$fr->[3];}) }
Truth table0%0/3
A || B
A= $fr->[6]B= do { require B::Deparse; no strict 'refs'; 'B::Deparse'->new->coderef2text(\&{$fr->[3];}) }
ABresult
1X1
011
000
408 0 require B::Deparse;
409 388 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
410 0 B::Deparse->new->coderef2text(\&{$fr->[3]})
411 }),
412 ), 'with_stacktrace');
413 }
414 }
415  
416 388 1;
« DBIx/Class/Storage/DBI/UniqueIdentifier.pm ↑ Summary DBIx/Class/Storage/DBI/Firebird/Common.pm »