/usr/local/lib/perl5/5.44.0/Carp.pm

filter: Statementstmt 0.0% 0 / 245 Branchbran 0.0% 0 / 146 Conditioncond 0.0% 0 / 76 MC/DCmcdc 0.0% 0 / 40 Subroutinesub 0.0% 0 / 26 Podpod 0.0% 0 / 20 totaltotal 0.0% 0 / 553 CC 108 SCAR 48.7
CC
108
Cov
0%
caller_info
380.0
short_error_loc
240.0
_univ_mod_loaded
156.0
CRAP 129.9
« /usr/local/lib/perl5/5.44.0/x86_64-linux/File/Spec/Unix.pm ↑ Summary /usr/local/lib/perl5/5.44.0/feature.pm »
1 package Carp;
2  
3 { use 5.006; }
4 use strict;
5 use warnings;
6 BEGIN {
7 # Very old versions of warnings.pm load Carp. This can go wrong due
8 # to the circular dependency. If warnings is invoked before Carp,
9 # then warnings starts by loading Carp, then Carp (above) tries to
10 # invoke warnings, and gets nothing because warnings is in the process
11 # of loading and hasn't defined its import method yet. If we were
12 # only turning on warnings ("use warnings" above) this wouldn't be too
13 # bad, because Carp would just gets the state of the -w switch and so
14 # might not get some warnings that it wanted. The real problem is
15 # that we then want to turn off Unicode warnings, but "no warnings
16 # 'utf8'" won't be effective if we're in this circular-dependency
17 # situation. So, if warnings.pm is an affected version, we turn
18 # off all warnings ourselves by directly setting ${^WARNING_BITS}.
19 # On unaffected versions, we turn off just Unicode warnings, via
20 # the proper API.
21 if(!defined($warnings::VERSION) || eval($warnings::VERSION) < 1.06) {
22 ${^WARNING_BITS} = "";
23 } else {
24 "warnings"->unimport("utf8");
25 }
26 }
27  
28 sub _fetch_sub { # fetch sub without autovivifying
29 0 ▶ my($pack, $sub) = @_;
Subroutine _fetch_sub: not called CC=8 SCAR=42.8
30 0 $pack .= '::';
31 # only works with top-level packages
32 0 ▶ return unless exists($::{$pack});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $main::main::{$pack} 0 0 0
33 0 for ($::{$pack}) {
34 0 ▶ return unless ref \$_ eq 'GLOB' && *$_{HASH} && exists $$_{$sub};
Branch: 1 branch
BranchTrueFalseTotal
unless ref \$_ eq "GLOB" and *$_{"HASH"} and exists $_->{$sub} 0 0 0
Condition0%0/5
ref \$_ eq "GLOB" and *$_{"HASH"} and exists $_->{$sub}
!ll&&!rl&&r
000
ref \$_ eq "GLOB" and *$_{"HASH"}
!ll
00
MC/DC0%0/2
ref \$_ eq "GLOB" and *$_{"HASH"} and exists $_->{$sub}
ref \$_ eq "GLOB" exists $_->{$sub}
Truth table0%0/3
A and B
A= ref \$_ eq "GLOB"B= exists $_->{$sub}
ABresult
0X0
100
111
35 0 for ($$_{$sub}) {
36 return ref \$_ eq 'GLOB' ? *$_{CODE} : undef
37 0 ▶ }
Branch: 1 branch
BranchTrueFalseTotal
ref \$_ eq 'GLOB' ? : 0 0 0
38 }
39 }
40  
41 # UTF8_REGEXP_PROBLEM is a compile-time constant indicating whether Carp
42 # must avoid applying a regular expression to an upgraded (is_utf8)
43 # string. There are multiple problems, on different Perl versions,
44 # that require this to be avoided. All versions prior to 5.13.8 will
45 # load utf8_heavy.pl for the swash system, even if the regexp doesn't
46 # use character classes. Perl 5.6 and Perls [5.11.2, 5.13.11) exhibit
47 # specific problems when Carp is being invoked in the aftermath of a
48 # syntax error.
49 BEGIN {
50 if("$]" < 5.013011) {
51 *UTF8_REGEXP_PROBLEM = sub () { 1 };
52 } else {
53 *UTF8_REGEXP_PROBLEM = sub () { 0 };
54 }
55 }
56  
57 # is_utf8() is essentially the utf8::is_utf8() function, which indicates
58 # whether a string is represented in the upgraded form (using UTF-8
59 # internally). As utf8::is_utf8() is only available from Perl 5.8
60 # onwards, extra effort is required here to make it work on Perl 5.6.
61 BEGIN {
62 if(defined(my $sub = _fetch_sub utf8 => 'is_utf8')) {
63 *is_utf8 = $sub;
64 } else {
65 # black magic for perl 5.6
66 *is_utf8 = sub { unpack("C", "\xaa".$_[0]) != 170 };
67 }
68 }
69  
70 # The downgrade() function defined here is to be used for attempts to
71 # downgrade where it is acceptable to fail. It must be called with a
72 # second argument that is a true value.
73 BEGIN {
74 if(defined(my $sub = _fetch_sub utf8 => 'downgrade')) {
75 *downgrade = \&{"utf8::downgrade"};
76 } else {
77 *downgrade = sub {
78 my $r = "";
79 my $l = length($_[0]);
80 for(my $i = 0; $i != $l; $i++) {
81 my $o = ord(substr($_[0], $i, 1));
82 return if $o > 255;
83 $r .= chr($o);
84 }
85 $_[0] = $r;
86 };
87 }
88 }
89  
90 # is_safe_printable_codepoint() indicates whether a character, specified
91 # by integer codepoint, is OK to output literally in a trace. Generally
92 # this is if it is a printable character in the ancestral character set
93 # (ASCII or EBCDIC). This is used on some Perls in situations where a
94 # regexp can't be used.
95 BEGIN {
96 *is_safe_printable_codepoint =
97 "$]" >= 5.007_003 ?
98 eval(q(sub ($) {
99 my $u = utf8::native_to_unicode($_[0]);
100 $u >= 0x20 && $u <= 0x7e;
101 }))
102 : ord("A") == 65 ?
103 sub ($) { $_[0] >= 0x20 && $_[0] <= 0x7e }
104 :
105 sub ($) {
106 # Early EBCDIC
107 # 3 EBCDIC code pages supported then; all controls but one
108 # are the code points below SPACE. The other one is 0x5F on
109 # POSIX-BC; FF on the other two.
110 # FIXME: there are plenty of unprintable codepoints other
111 # than those that this code and the comment above identifies
112 # as "controls".
113 $_[0] >= ord(" ") && $_[0] <= 0xff &&
114 $_[0] != (ord ("^") == 106 ? 0x5f : 0xff);
115 }
116 ;
117 }
118  
119 sub _univ_mod_loaded {
120 0 ▶ return 0 unless exists($::{"UNIVERSAL::"});
Subroutine _univ_mod_loaded: not called CC=12 SCAR=50.5
Branch: 1 branch
BranchTrueFalseTotal
unless exists $main::main::{"UNIVERSAL::"} 0 0 0
121 0 for ($::{"UNIVERSAL::"}) {
122 0 ▶ return 0 unless ref \$_ eq "GLOB" && *$_{HASH} && exists $$_{"$_[0]::"};
Branch: 1 branch
BranchTrueFalseTotal
unless ref \$_ eq "GLOB" and *$_{"HASH"} and exists $$_{"$_[0]::"} 0 0 0
Condition0%0/5
ref \$_ eq "GLOB" and *$_{"HASH"} and exists $$_{"$_[0]::"}
!ll&&!rl&&r
000
ref \$_ eq "GLOB" and *$_{"HASH"}
!ll
00
MC/DC0%0/2
ref \$_ eq "GLOB" and *$_{"HASH"} and exists $$_{"$_[0]::"}
ref \$_ eq "GLOB" exists $$_{"$_[0]::"}
Truth table0%0/3
A and B
A= ref \$_ eq "GLOB"B= exists $$_{"$_[0]::"}
ABresult
0X0
100
111
123 0 for ($$_{"$_[0]::"}) {
124 0 ▶ return 0 unless ref \$_ eq "GLOB" && *$_{HASH} && exists $$_{"VERSION"};
Branch: 1 branch
BranchTrueFalseTotal
unless ref \$_ eq "GLOB" and *$_{"HASH"} and exists $_->{"VERSION"} 0 0 0
Condition0%0/5
ref \$_ eq "GLOB" and *$_{"HASH"} and exists $_->{"VERSION"}
!ll&&!rl&&r
000
ref \$_ eq "GLOB" and *$_{"HASH"}
!ll
00
MC/DC0%0/2
ref \$_ eq "GLOB" and *$_{"HASH"} and exists $_->{"VERSION"}
ref \$_ eq "GLOB" exists $_->{"VERSION"}
Truth table0%0/3
A and B
A= ref \$_ eq "GLOB"B= exists $_->{"VERSION"}
ABresult
0X0
100
111
125 0 for ($$_{"VERSION"}) {
126 0 ▶ return 0 unless ref \$_ eq "GLOB";
Branch: 1 branch
BranchTrueFalseTotal
unless ref \$_ eq "GLOB" 0 0 0
127 0 return ${*$_{SCALAR}};
128 }
129 }
130 }
131 }
132  
133 # _maybe_isa() is usually the UNIVERSAL::isa function. We have to avoid
134 # the latter if the UNIVERSAL::isa module has been loaded, to avoid infi-
135 # nite recursion; in that case _maybe_isa simply returns true.
136 my $isa;
137 BEGIN {
138 if (_univ_mod_loaded('isa')) {
139 *_maybe_isa = sub { 1 }
140 }
141 else {
142 # Since we have already done the check, record $isa for use below
143 # when defining _StrVal.
144 *_maybe_isa = $isa = _fetch_sub(UNIVERSAL => "isa");
145 }
146 }
147  
148  
149 # We need an overload::StrVal or equivalent function, but we must avoid
150 # loading any modules on demand, as Carp is used from __DIE__ handlers and
151 # may be invoked after a syntax error.
152 # We can copy recent implementations of overload::StrVal and use
153 # overloading.pm, which is the fastest implementation, so long as
154 # overloading is available. If it is not available, we use our own pure-
155 # Perl StrVal. We never actually use overload::StrVal, for various rea-
156 # sons described below.
157 # overload versions are as follows:
158 # undef-1.00 (up to perl 5.8.0) uses bless (avoid!)
159 # 1.01-1.17 (perl 5.8.1 to 5.14) uses Scalar::Util
160 # 1.18+ (perl 5.16+) uses overloading
161 # The ancient 'bless' implementation (that inspires our pure-Perl version)
162 # blesses unblessed references and must be avoided. Those using
163 # Scalar::Util use refaddr, possibly the pure-Perl implementation, which
164 # has the same blessing bug, and must be avoided. Also, Scalar::Util is
165 # loaded on demand. Since we avoid the Scalar::Util implementations, we
166 # end up having to implement our own overloading.pm-based version for perl
167 # 5.10.1 to 5.14. Since it also works just as well in more recent ver-
168 # sions, we use it there, too.
169 BEGIN {
170 if (eval { require "overloading.pm" }) {
171 *_StrVal = eval 'sub { no overloading; "$_[0]" }'
172 }
173 else {
174 # Work around the UNIVERSAL::can/isa modules to avoid recursion.
175  
176 # _mycan is either UNIVERSAL::can, or, in the presence of an
177 # override, overload::mycan.
178 *_mycan = _univ_mod_loaded('can')
179 ? do { require "overload.pm"; _fetch_sub overload => 'mycan' }
180 : \&UNIVERSAL::can;
181  
182 # _blessed is either UNIVERSAL::isa(...), or, in the presence of an
183 # override, a hideous, but fairly reliable, workaround.
184 *_blessed = $isa
185 ? sub { &$isa($_[0], "UNIVERSAL") }
186 : sub {
187 my $probe = "UNIVERSAL::Carp_probe_" . rand;
188 no strict 'refs';
189 local *$probe = sub { "unlikely string" };
190 local $@;
191 local $SIG{__DIE__} = sub{};
192 (eval { $_[0]->$probe } || '') eq 'unlikely string'
193 };
194  
195 *_StrVal = sub {
196 my $pack = ref $_[0];
197 # Perl's overload mechanism uses the presence of a special
198 # "method" named "((" or "()" to signal it is in effect.
199 # This test seeks to see if it has been set up. "((" post-
200 # dates overloading.pm, so we can skip it.
201 return "$_[0]" unless _mycan($pack, "()");
202 # Even at this point, the invocant may not be blessed, so
203 # check for that.
204 return "$_[0]" if not _blessed($_[0]);
205 bless $_[0], "Carp";
206 my $str = "$_[0]";
207 bless $_[0], $pack;
208 $pack . substr $str, index $str, "=";
209 }
210 }
211 }
212  
213  
214 our $VERSION = '1.54';
215 $VERSION =~ tr/_//d;
216  
217 our $MaxEvalLen = 0;
218 our $Verbose = 0;
219 our $CarpLevel = 0;
220 our $MaxArgLen = 64; # How much of each argument to print. 0 = all.
221 our $MaxArgNums = 8; # How many arguments to print. 0 = all.
222 our $RefArgFormatter = undef; # allow caller to format reference arguments
223  
224 require Exporter;
225 our @ISA = ('Exporter');
226 our @EXPORT = qw(confess croak carp);
227 our @EXPORT_OK = qw(cluck verbose longmess shortmess);
228 our @EXPORT_FAIL = qw(verbose); # hook to enable verbose mode
229  
230 # The members of %Internal are packages that are internal to perl.
231 # Carp will not report errors from within these packages if it
232 # can. The members of %CarpInternal are internal to Perl's warning
233 # system. Carp will not report errors from within these packages
234 # either, and will not report calls *to* these packages for carp and
235 # croak. They replace $CarpLevel, which is deprecated. The
236 # $Max(EvalLen|(Arg(Len|Nums)) variables are used to specify how the eval
237 # text and function arguments should be formatted when printed.
238  
239 our %CarpInternal;
240 our %Internal;
241  
242 # disable these by default, so they can live w/o require Carp
243 $CarpInternal{Carp}++;
244 $CarpInternal{warnings}++;
245 $Internal{Exporter}++;
246 $Internal{'Exporter::Heavy'}++;
247  
248 # if the caller specifies verbose usage ("perl -MCarp=verbose script.pl")
249 # then the following method will be called by the Exporter which knows
250 # to do this thanks to @EXPORT_FAIL, above. $_[1] will contain the word
251 # 'verbose'.
252  
253 0 ▶sub export_fail { shift; $Verbose = shift if $_[0] eq 'verbose'; @_ }
Subroutine export_fail: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] eq "verbose" 0 0 0
254  
255 sub _cgc {
256 no strict 'refs';
257 0 ▶ return \&{"CORE::GLOBAL::caller"} if defined &{"CORE::GLOBAL::caller"};
Subroutine _cgc: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
if defined &{"CORE::GLOBAL::caller";} 0 0 0
258 0 return;
259 }
260  
261 sub longmess {
262 0 ▶ local($!, $^E);
Subroutine longmess: not called CC=4 SCAR=30.0
Pod undocumented
263 # Icky backwards compatibility wrapper. :-(
264 #
265 # The story is that the original implementation hard-coded the
266 # number of call levels to go back, so calls to longmess were off
267 # by one. Other code began calling longmess and expecting this
268 # behaviour, so the replacement has to emulate that behaviour.
269 0 my $cgc = _cgc();
270 0 ▶ my $call_pack = $cgc ? $cgc->() : caller();
Branch: 1 branch
BranchTrueFalseTotal
$cgc ? : 0 0 0
271 0 ▶ if ( $Internal{$call_pack} or $CarpInternal{$call_pack} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Carp::Internal{$call_pack} or $Carp::CarpInternal{$call_pack}) { } 0 0 0
Condition0%0/3
$Carp::Internal{$call_pack} or $Carp::CarpInternal{$call_pack}
l!l&&r!l&&!r
000
MC/DC0%0/2
$Carp::Internal{$call_pack} or $Carp::CarpInternal{$call_pack}
$Carp::Internal{$call_pack} $Carp::CarpInternal{$call_pack}
Truth table0%0/3
A or B
A= $Carp::Internal{$call_pack}B= $Carp::CarpInternal{$call_pack}
ABresult
1X1
011
000
272 0 return longmess_heavy(@_);
273 }
274 else {
275 0 local $CarpLevel = $CarpLevel + 1;
276 0 return longmess_heavy(@_);
277 }
278 }
279  
280 our @CARP_NOT;
281  
282 sub shortmess {
283 0 ▶ local($!, $^E);
Subroutine shortmess: not called CC=2 SCAR=17.9
Pod undocumented
284 0 my $cgc = _cgc();
285  
286 # Icky backwards compatibility wrapper. :-(
287 0 ▶ local @CARP_NOT = scalar( $cgc ? $cgc->() : caller() );
Branch: 1 branch
BranchTrueFalseTotal
$cgc ? : 0 0 0
288 0 shortmess_heavy(@_);
289 }
290  
291 0 ▶sub croak { die shortmess @_ }
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
292 0 ▶sub confess { die longmess @_ }
Subroutine confess: not called CC=1 SCAR=6.9
Pod undocumented
293 0 ▶sub carp { warn shortmess @_ }
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
294 0 ▶sub cluck { warn longmess @_ }
Subroutine cluck: not called CC=1 SCAR=6.9
Pod undocumented
295  
296 BEGIN {
297 if("$]" >= 5.015002 || ("$]" >= 5.014002 && "$]" < 5.015) ||
298 ("$]" >= 5.012005 && "$]" < 5.013)) {
299 *CALLER_OVERRIDE_CHECK_OK = sub () { 1 };
300 } else {
301 *CALLER_OVERRIDE_CHECK_OK = sub () { 0 };
302 }
303 }
304  
305 sub caller_info {
306 0 ▶ my $i = shift(@_) + 1;
Subroutine caller_info: not called CC=19 SCAR=59.4
Pod undocumented
307 0 my %call_info;
308 0 my $cgc = _cgc();
309 {
310 # Some things override caller() but forget to implement the
311 # @DB::args part of it, which we need. We check for this by
312 # pre-populating @DB::args with a sentinel which no-one else
313 # has the address of, so that we can detect whether @DB::args
314 # has been properly populated. However, on earlier versions
315 # of perl this check tickles a bug in CORE::caller() which
316 # leaks memory. So we only check on fixed perls.
317 0 @DB::args = \$i if CALLER_OVERRIDE_CHECK_OK;
318 package DB;
319 @call_info{
320 0 ▶ qw(pack file line sub has_args wantarray evaltext is_require) }
Branch: 1 branch
BranchTrueFalseTotal
$cgc ? : 0 0 0
321 = $cgc ? $cgc->($i) : caller($i);
322 }
323  
324 0 ▶ unless ( defined $call_info{file} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $call_info{"file"}) 0 0 0
325 0 return ();
326 }
327  
328 0 my $sub_name = Carp::get_subname( \%call_info );
329 0 ▶ if ( $call_info{has_args} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call_info{"has_args"}) 0 0 0
330 # Guard our serialization of the stack from stack refcounting bugs
331 # NOTE this is NOT a complete solution, we cannot 100% guard against
332 # these bugs. However in many cases Perl *is* capable of detecting
333 # them and throws an error when it does. Unfortunately serializing
334 # the arguments on the stack is a perfect way of finding these bugs,
335 # even when they would not affect normal program flow that did not
336 # poke around inside the stack. Inside of Carp.pm it makes little
337 # sense reporting these bugs, as Carp's job is to report the callers
338 # errors, not the ones it might happen to tickle while doing so.
339 # See: https://rt.perl.org/Public/Bug/Display.html?id=131046
340 # and: https://rt.perl.org/Public/Bug/Display.html?id=52610
341 # for more details and discussion. - Yves
342 my @args = map {
343 0 my $arg;
344 0 local $@= $@;
345 eval {
346 0 $arg = $_;
347 0 1;
348 0 ▶ } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $arg = $_; 1 } } or do { $arg = "** argument not available anymore **" } 0 0 0
349 0 $arg = '** argument not available anymore **';
350 };
351 0 $arg;
352 } @DB::args;
353 0 ▶ if (CALLER_OVERRIDE_CHECK_OK && @args == 1
Branch: 1 branch
BranchTrueFalseTotal
if (@args == 1 and ref $args[0] eq ref \$i and $args[0] == \$i) { } 0 0 0
Condition0%0/6
@args == 1 and ref $args[0] eq ref \$i and $args[0] == \$i
!ll&&!rl&&r
000
@args == 1 and ref $args[0] eq ref \$i
!ll&&!rl&&r
000
MC/DC0%0/3
@args == 1 and ref $args[0] eq ref \$i and $args[0] == \$i
@args == 1 ref $args[0] eq ref \$i $args[0] == \$i
Truth table0%0/4
A and B and C
A= @args == 1B= ref $args[0] eq ref \$iC= $args[0] == \$i
ABCresult
0XX0
10X0
1100
1111
354 && ref $args[0] eq ref \$i
355 && $args[0] == \$i ) {
356 0 @args = (); # Don't let anyone see the address of $i
357 0 local $@;
358 0 ▶ my $where = eval {
Condition0%0/2
eval { do { my $func = $cgc or return ''; my $gv = (_fetch_sub('B', 'svref_2object') || (return ''))->($func)->GV; my $package = $gv->STASH->NAME; my $subname = $gv->NAME; return unless defined $package and defined $subname; return if $package eq 'CORE::GLOBAL' and $subname eq 'caller'; " in &${package}::$subname" } } || ''
l!l
00
MC/DC0%0/1
eval { do { my $func = $cgc or return ''; my $gv = (_fetch_sub('B', 'svref_2object') || (return ''))->($func)->GV; my $package = $gv->STASH->NAME; my $subname = $gv->NAME; return unless defined $package and defined $subname; return if $package eq 'CORE::GLOBAL' and $subname eq 'caller'; " in &${package}::$subname" } } || ''
eval { do { my $func = $cgc or return ''; my $gv = (_fetch_sub('B', 'svref_2object') || (return ''))->($func)->GV; my $package = $gv->STASH->NAME; my $subname = $gv->NAME; return unless defined $package and defined $subname; return if $package eq 'CORE::GLOBAL' and $subname eq 'caller'; " in &${package}::$subname" } }
Truth table0%0/2
A
A= eval { do { my $func = $cgc or return ''; my $gv = (_fetch_sub('B', 'svref_2object') || (return ''))->($func)->GV; my $package = $gv->STASH->NAME; my $subname = $gv->NAME; return unless defined $package and defined $subname; return if $package eq 'CORE::GLOBAL' and $subname eq 'caller'; " in &${package}::$subname" } }
Aresult
11
00
359 0 ▶ my $func = $cgc or return '';
Branch: 1 branch
BranchTrueFalseTotal
my $func = $cgc or return "" 0 0 0
360 0 ▶ my $gv =
Condition0%0/2
_fetch_sub('B', 'svref_2object') || (return '')
l!l
00
MC/DC0%0/1
_fetch_sub('B', 'svref_2object') || (return '')
_fetch_sub('B', 'svref_2object')
Truth table0%0/2
A
A= _fetch_sub('B', 'svref_2object')
Aresult
11
00
361 (_fetch_sub B => 'svref_2object' or return '')
362 ->($func)->GV;
363 0 my $package = $gv->STASH->NAME;
364 0 my $subname = $gv->NAME;
365 0 ▶ return unless defined $package && defined $subname;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $package and defined $subname 0 0 0
Condition0%0/3
defined $package and defined $subname
!ll&&!rl&&r
000
MC/DC0%0/2
defined $package and defined $subname
defined $package defined $subname
Truth table0%0/3
A and B
A= defined $packageB= defined $subname
ABresult
0X0
100
111
366  
367 # returning CORE::GLOBAL::caller isn't useful for tracing the cause:
368 0 ▶ return if $package eq 'CORE::GLOBAL' && $subname eq 'caller';
Branch: 1 branch
BranchTrueFalseTotal
if $package eq "CORE::GLOBAL" and $subname eq "caller" 0 0 0
Condition0%0/3
$package eq "CORE::GLOBAL" and $subname eq "caller"
!ll&&!rl&&r
000
MC/DC0%0/2
$package eq "CORE::GLOBAL" and $subname eq "caller"
$package eq "CORE::GLOBAL" $subname eq "caller"
Truth table0%0/3
A and B
A= $package eq "CORE::GLOBAL"B= $subname eq "caller"
ABresult
0X0
100
111
369 0 " in &${package}::$subname";
370 } || '';
371 @args
372 0 = "** Incomplete caller override detected$where; \@DB::args were not set **";
373 }
374 else {
375 0 my $overflow;
376 0 ▶ if ( $MaxArgNums and @args > $MaxArgNums )
Branch: 1 branch
BranchTrueFalseTotal
if ($Carp::MaxArgNums and @args > $Carp::MaxArgNums) 0 0 0
Condition0%0/3
$Carp::MaxArgNums and @args > $Carp::MaxArgNums
!ll&&!rl&&r
000
MC/DC0%0/2
$Carp::MaxArgNums and @args > $Carp::MaxArgNums
$Carp::MaxArgNums @args > $Carp::MaxArgNums
Truth table0%0/3
A and B
A= $Carp::MaxArgNumsB= @args > $Carp::MaxArgNums
ABresult
0X0
100
111
377 { # More than we want to show?
378 0 $#args = $MaxArgNums - 1;
379 0 $overflow = 1;
380 }
381  
382 0 @args = map { Carp::format_arg($_) } @args;
383  
384 0 ▶ if ($overflow) {
Branch: 1 branch
BranchTrueFalseTotal
if ($overflow) 0 0 0
385 0 push @args, '...';
386 }
387 }
388  
389 # Push the args onto the subroutine
390 0 $sub_name .= '(' . join( ', ', @args ) . ')';
391 }
392 0 $call_info{sub_name} = $sub_name;
393 0 ▶ return wantarray() ? %call_info : \%call_info;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
394 }
395  
396 # Transform an argument to a function into a string.
397 our $in_recurse;
398 sub format_arg {
399 0 ▶ my $arg = shift;
Subroutine format_arg: not called CC=12 SCAR=50.5
Pod undocumented
400  
401 0 ▶ if ( my $pack= ref($arg) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $pack = ref $arg) 0 0 0
402  
403 # legitimate, let's not leak it.
404 0 ▶ if (!$in_recurse && _maybe_isa( $arg, 'UNIVERSAL' ) &&
Branch: 2 branches
BranchTrueFalseTotal
if (not $Carp::in_recurse and _maybe_isa($arg, 'UNIVERSAL') and do { local $@; local $Carp::in_recurse = 1; local $SIG{'__DIE__'} = sub { } ; eval { do { $arg->can('CARP_TRACE') } } }) { } 0 0 0
elsif (not $Carp::in_recurse and defined $Carp::RefArgFormatter and do { local $@; local $Carp::in_recurse = 1; local $SIG{'__DIE__'} = sub { } ; eval { do { $arg = &$Carp::RefArgFormatter($arg); 1 } } }) { } 0 0 0
Condition0%0/6
not $Carp::in_recurse and _maybe_isa($arg, "UNIVERSAL") and do { local $@; local $Carp::in_recurse = 1; local $SIG{"__DIE__"} = sub { } ; eval { do { $arg->can("CARP_TRACE") } } }
!ll&&!rl&&r
000
not $Carp::in_recurse and _maybe_isa($arg, "UNIVERSAL")
!ll&&!rl&&r
000
MC/DC0%0/3
not $Carp::in_recurse and _maybe_isa($arg, "UNIVERSAL") and do { local $@; local $Carp::in_recurse = 1; local $SIG{"__DIE__"} = sub { } ; eval { do { $arg->can("CARP_TRACE") } } }
not $Carp::in_recurse _maybe_isa($arg, "UNIVERSAL") do { local $@; local $Carp::in_recurse = 1; local $SIG{"__DIE__"} = sub { } ; eval { do { $arg->can("CARP_TRACE") } } }
Truth table0%0/4
not(A) and B and C
A= not $Carp::in_recurseB= _maybe_isa($arg, "UNIVERSAL")C= do { local $@; local $Carp::in_recurse = 1; local $SIG{"__DIE__"} = sub { } ; eval { do { $arg->can("CARP_TRACE") } } }
ABCresult
0XX0
10X0
1100
1111
405 do {
406 0 local $@;
407 0 local $in_recurse = 1;
408 0 ▶ local $SIG{__DIE__} = sub{};
Subroutine __ANON__: not called CC=1 SCAR=6.9
409 0 eval {$arg->can('CARP_TRACE') }
410 })
411 {
412 0 return $arg->CARP_TRACE();
413 }
414 ▶ elsif (!$in_recurse &&
Condition0%0/6
not $Carp::in_recurse and defined $Carp::RefArgFormatter and do { local $@; local $Carp::in_recurse = 1; local $SIG{"__DIE__"} = sub { } ; eval { do { $arg = &$Carp::RefArgFormatter($arg); 1 } } }
!ll&&!rl&&r
000
not $Carp::in_recurse and defined $Carp::RefArgFormatter
!ll&&!rl&&r
000
MC/DC0%0/3
not $Carp::in_recurse and defined $Carp::RefArgFormatter and do { local $@; local $Carp::in_recurse = 1; local $SIG{"__DIE__"} = sub { } ; eval { do { $arg = &$Carp::RefArgFormatter($arg); 1 } } }
not $Carp::in_recurse defined $Carp::RefArgFormatter do { local $@; local $Carp::in_recurse = 1; local $SIG{"__DIE__"} = sub { } ; eval { do { $arg = &$Carp::RefArgFormatter($arg); 1 } } }
Truth table0%0/4
not(A) and B and C
A= not $Carp::in_recurseB= defined $Carp::RefArgFormatterC= do { local $@; local $Carp::in_recurse = 1; local $SIG{"__DIE__"} = sub { } ; eval { do { $arg = &$Carp::RefArgFormatter($arg); 1 } } }
ABCresult
0XX0
10X0
1100
1111
415 defined($RefArgFormatter) &&
416 do {
417 0 local $@;
418 0 local $in_recurse = 1;
419 0 ▶ local $SIG{__DIE__} = sub{};
Subroutine __ANON__: not called CC=1 SCAR=6.9
420 0 eval {$arg = $RefArgFormatter->($arg); 1}
421 })
422 {
423 0 return $arg;
424 }
425 else
426 {
427 # Argument may be blessed into a class with overloading, and so
428 # might have an overloaded stringification. We don't want to
429 # risk getting the overloaded stringification, so we need to
430 # use _StrVal, our overload::StrVal()-equivalent.
431 0 return _StrVal $arg;
432 }
433 }
434 0 ▶ return "undef" if !defined($arg);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $arg 0 0 0
435 0 downgrade($arg, 1);
436 0 ▶ return $arg if !(UTF8_REGEXP_PROBLEM && is_utf8($arg)) &&
Branch: 1 branch
BranchTrueFalseTotal
if $arg =~ /\A-?[0-9]+(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?\z/ 0 0 0
437 $arg =~ /\A-?[0-9]+(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?\z/;
438 0 my $suffix = "";
439 0 ▶ if ( 2 < $MaxArgLen and $MaxArgLen < length($arg) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (2 < $Carp::MaxArgLen and $Carp::MaxArgLen < length $arg) 0 0 0
Condition0%0/3
2 < $Carp::MaxArgLen and $Carp::MaxArgLen < length $arg
!ll&&!rl&&r
000
MC/DC0%0/2
2 < $Carp::MaxArgLen and $Carp::MaxArgLen < length $arg
2 < $Carp::MaxArgLen $Carp::MaxArgLen < length $arg
Truth table0%0/3
A and B
A= 2 < $Carp::MaxArgLenB= $Carp::MaxArgLen < length $arg
ABresult
0X0
100
111
440 0 substr ( $arg, $MaxArgLen - 3 ) = "";
441 0 $suffix = "...";
442 }
443 0 if(UTF8_REGEXP_PROBLEM && is_utf8($arg)) {
444 for(my $i = length($arg); $i--; ) {
445 my $c = substr($arg, $i, 1);
446 my $x = substr($arg, 0, 0); # work around bug on Perl 5.8.{1,2}
447 if($c eq "\"" || $c eq "\\" || $c eq "\$" || $c eq "\@") {
448 substr $arg, $i, 0, "\\";
449 next;
450 }
451 my $o = ord($c);
452 substr $arg, $i, 1, sprintf("\\x{%x}", $o)
453 unless is_safe_printable_codepoint($o);
454 }
455 } else {
456 0 $arg =~ s/([\"\\\$\@])/\\$1/g;
457 # This is all the ASCII printables spelled-out. It is portable to all
458 # Perl versions and platforms (such as EBCDIC). There are other more
459 # compact ways to do this, but may not work everywhere every version.
460 0 $arg =~ s/([^ !"#\$\%\&'()*+,\-.\/0123456789:;<=>?\@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]^_`abcdefghijklmnopqrstuvwxyz\{|}~])/sprintf("\\x{%x}",ord($1))/eg;
461 }
462 0 downgrade($arg, 1);
463 0 return "\"".$arg."\"".$suffix;
464 }
465  
466 sub Regexp::CARP_TRACE {
467 0 ▶ my $arg = "$_[0]";
Subroutine CARP_TRACE: not called CC=4 SCAR=30.0
468 0 downgrade($arg, 1);
469 0 if(UTF8_REGEXP_PROBLEM && is_utf8($arg)) {
470 for(my $i = length($arg); $i--; ) {
471 my $o = ord(substr($arg, $i, 1));
472 my $x = substr($arg, 0, 0); # work around bug on Perl 5.8.{1,2}
473 substr $arg, $i, 1, sprintf("\\x{%x}", $o)
474 unless is_safe_printable_codepoint($o);
475 }
476 } else {
477 # See comment in format_arg() about this same regex.
478 0 $arg =~ s/([^ !"#\$\%\&'()*+,\-.\/0123456789:;<=>?\@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]^_`abcdefghijklmnopqrstuvwxyz\{|}~])/sprintf("\\x{%x}",ord($1))/eg;
479 }
480 0 downgrade($arg, 1);
481 0 my $suffix = "";
482 0 ▶ if($arg =~ /\A\(\?\^?([a-z]*)(?:-[a-z]*)?:(.*)\)\z/s) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg =~ /\A\(\?\^?([a-z]*)(?:-[a-z]*)?:(.*)\)\z/s) 0 0 0
483 0 ($suffix, $arg) = ($1, $2);
484 }
485 0 ▶ if ( 2 < $MaxArgLen and $MaxArgLen < length($arg) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (2 < $Carp::MaxArgLen and $Carp::MaxArgLen < length $arg) 0 0 0
Condition0%0/3
2 < $Carp::MaxArgLen and $Carp::MaxArgLen < length $arg
!ll&&!rl&&r
000
MC/DC0%0/2
2 < $Carp::MaxArgLen and $Carp::MaxArgLen < length $arg
2 < $Carp::MaxArgLen $Carp::MaxArgLen < length $arg
Truth table0%0/3
A and B
A= 2 < $Carp::MaxArgLenB= $Carp::MaxArgLen < length $arg
ABresult
0X0
100
111
486 0 substr ( $arg, $MaxArgLen - 3 ) = "";
487 0 $suffix = "...".$suffix;
488 }
489 0 return "qr($arg)$suffix";
490 }
491  
492 # Takes an inheritance cache and a package and returns
493 # an anon hash of known inheritances and anon array of
494 # inheritances which consequences have not been figured
495 # for.
496 sub get_status {
497 0 ▶ my $cache = shift;
Subroutine get_status: not called CC=2 SCAR=17.9
Pod undocumented
498 0 my $pkg = shift;
499 0 ▶ $cache->{$pkg} ||= [ { $pkg => $pkg }, [ trusts_directly($pkg) ] ];
Condition0%0/2
$cache->{$pkg} ||= [{$pkg, $pkg}, [trusts_directly($pkg)]]
l!l
00
MC/DC0%0/1
$cache->{$pkg} ||= [{$pkg, $pkg}, [trusts_directly($pkg)]]
$cache->{$pkg}
Truth table0%0/2
A
A= $cache->{$pkg}
Aresult
11
00
500 0 return @{ $cache->{$pkg} };
501 }
502  
503 # Takes the info from caller() and figures out the name of
504 # the sub/require/eval
505 sub get_subname {
506 0 ▶ my $info = shift;
Subroutine get_subname: not called CC=5 SCAR=34.0
Pod undocumented
507 0 ▶ if ( defined( $info->{evaltext} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $info->{"evaltext"}) 0 0 0
508 0 my $eval = $info->{evaltext};
509 0 ▶ if ( $info->{is_require} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($info->{'is_require'}) { } 0 0 0
510 0 return "require $eval";
511 }
512 else {
513 0 $eval =~ s/([\\\'])/\\$1/g;
514 0 return "eval '" . str_len_trim( $eval, $MaxEvalLen ) . "'";
515 }
516 }
517  
518 # this can happen on older perls when the sub (or the stash containing it)
519 # has been deleted
520 0 ▶ if ( !defined( $info->{sub} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $info->{"sub"}) 0 0 0
521 0 return '__ANON__::__ANON__';
522 }
523  
524 0 ▶ return ( $info->{sub} eq '(eval)' ) ? 'eval {...}' : $info->{sub};
Branch: 1 branch
BranchTrueFalseTotal
$info->{'sub'} eq '(eval)' ? : 0 0 0
525 }
526  
527 # Figures out what call (from the point of view of the caller)
528 # the long error backtrace should start at.
529 sub long_error_loc {
530 0 ▶ my $i;
Subroutine long_error_loc: not called CC=9 SCAR=45.0
Pod undocumented
531 0 my $lvl = $CarpLevel;
532 {
533 0 ++$i;
534 0 my $cgc = _cgc();
535 0 ▶ my @caller = $cgc ? $cgc->($i) : caller($i);
Branch: 1 branch
BranchTrueFalseTotal
$cgc ? : 0 0 0
536 0 my $pkg = $caller[0];
537 0 ▶ unless ( defined($pkg) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pkg) 0 0 0
538  
539 # This *shouldn't* happen.
540 0 ▶ if (%Internal) {
Branch: 2 branches
BranchTrueFalseTotal
if (%Carp::Internal) { } 0 0 0
elsif (defined $caller[2]) { } 0 0 0
541 0 local %Internal;
542 0 $i = long_error_loc();
543 0 last;
544 }
545 elsif (defined $caller[2]) {
546 # this can happen when the stash has been deleted
547 # in that case, just assume that it's a reasonable place to
548 # stop (the file and line data will still be intact in any
549 # case) - the only issue is that we can't detect if the
550 # deleted package was internal (so don't do that then)
551 # -doy
552 0 ▶ redo unless 0 > --$lvl;
Branch: 1 branch
BranchTrueFalseTotal
unless 0 > --$lvl 0 0 0
553 0 last;
554 }
555 else {
556 0 return 2;
557 }
558 }
559 0 ▶ redo if $CarpInternal{$pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $Carp::CarpInternal{$pkg} 0 0 0
560 0 ▶ redo unless 0 > --$lvl;
Branch: 1 branch
BranchTrueFalseTotal
unless 0 > --$lvl 0 0 0
561 0 ▶ redo if $Internal{$pkg};
Branch: 1 branch
BranchTrueFalseTotal
if $Carp::Internal{$pkg} 0 0 0
562 }
563 0 return $i - 1;
564 }
565  
566 sub longmess_heavy {
567 0 ▶ if ( ref( $_[0] ) ) { # don't break references as exceptions
Subroutine longmess_heavy: not called CC=3 SCAR=24.8
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0]) 0 0 0
568 0 ▶ return wantarray ? @_ : $_[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
569 }
570 0 my $i = long_error_loc();
571 0 return ret_backtrace( $i, @_ );
572 }
573  
574 BEGIN {
575 if("$]" >= 5.017004) {
576 # The LAST_FH constant is a reference to the variable.
577 $Carp::{LAST_FH} = \eval '\${^LAST_FH}';
578 } else {
579 eval '*LAST_FH = sub () { 0 }';
580 }
581 }
582  
583 # Returns a full stack backtrace starting from where it is
584 # told.
585 sub ret_backtrace {
586 0 ▶ my ( $i, @error ) = @_;
Subroutine ret_backtrace: not called CC=7 SCAR=40.3
Pod undocumented
587 0 my $mess;
588 0 my $err = join '', @error;
589 0 $i++;
590  
591 0 my $tid_msg = '';
592 0 ▶ if ( defined &threads::tid ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &threads::tid) 0 0 0
593 0 my $tid = threads->tid;
594 0 ▶ $tid_msg = " thread $tid" if $tid;
Branch: 1 branch
BranchTrueFalseTotal
if $tid 0 0 0
595 }
596  
597 0 my %i = caller_info($i);
598 0 $mess = "$err at $i{file} line $i{line}$tid_msg";
599 0 ▶ if( $. ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($.) 0 0 0
600 # Use ${^LAST_FH} if available.
601 0 if (LAST_FH) {
602 0 ▶ if (${+LAST_FH}) {
Branch: 1 branch
BranchTrueFalseTotal
if (${\undef;}) 0 0 0
603 $mess .= sprintf ", <%s> %s %d",
604 0 ▶ *${+LAST_FH}{NAME},
Branch: 1 branch
BranchTrueFalseTotal
$/ eq "\n" ? : 0 0 0
605 0 ($/ eq "\n" ? "line" : "chunk"), $.
606 }
607 }
608 else {
609 local $@ = '';
610 local $SIG{__DIE__};
611 eval {
612 CORE::die;
613 };
614 if($@ =~ /^Died at .*(, <.*?> (?:line|chunk) \d+).$/ ) {
615 $mess .= $1;
616 }
617 }
618 }
619 0 $mess .= "\.\n";
620  
621 0 ▶ while ( my %i = caller_info( ++$i ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(%i) = caller_info(++$i)) 0 0 0
622 0 $mess .= "\t$i{sub_name} called at $i{file} line $i{line}$tid_msg\n";
623 }
624  
625 0 return $mess;
626 }
627  
628 sub ret_summary {
629 0 ▶ my ( $i, @error ) = @_;
Subroutine ret_summary: not called CC=3 SCAR=24.8
Pod undocumented
630 0 my $err = join '', @error;
631 0 $i++;
632  
633 0 my $tid_msg = '';
634 0 ▶ if ( defined &threads::tid ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined &threads::tid) 0 0 0
635 0 my $tid = threads->tid;
636 0 ▶ $tid_msg = " thread $tid" if $tid;
Branch: 1 branch
BranchTrueFalseTotal
if $tid 0 0 0
637 }
638  
639 0 my %i = caller_info($i);
640 0 return "$err at $i{file} line $i{line}$tid_msg\.\n";
641 }
642  
643 sub short_error_loc {
644 # You have to create your (hash)ref out here, rather than defaulting it
645 # inside trusts *on a lexical*, as you want it to persist across calls.
646 # (You can default it on $_[2], but that gets messy)
647 0 ▶ my $cache = {};
Subroutine short_error_loc: not called CC=15 SCAR=54.8
Pod undocumented
648 0 my $i = 1;
649 0 my $lvl = $CarpLevel;
650 {
651 0 my $cgc = _cgc();
652 0 ▶ my $called = $cgc ? $cgc->($i) : caller($i);
Branch: 1 branch
BranchTrueFalseTotal
$cgc ? : 0 0 0
653 0 $i++;
654 0 ▶ my $caller = $cgc ? $cgc->($i) : caller($i);
Branch: 1 branch
BranchTrueFalseTotal
$cgc ? : 0 0 0
655  
656 0 ▶ if (!defined($caller)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $caller) 0 0 0
657 0 ▶ my @caller = $cgc ? $cgc->($i) : caller($i);
Branch: 1 branch
BranchTrueFalseTotal
$cgc ? : 0 0 0
658 0 ▶ if (@caller) {
Branch: 1 branch
BranchTrueFalseTotal
if (@caller) { } 0 0 0
659 # if there's no package but there is other caller info, then
660 # the package has been deleted - treat this as a valid package
661 # in this case
662 0 ▶ redo if defined($called) && $CarpInternal{$called};
Branch: 1 branch
BranchTrueFalseTotal
if defined $called and $Carp::CarpInternal{$called} 0 0 0
Condition0%0/3
defined $called and $Carp::CarpInternal{$called}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $called and $Carp::CarpInternal{$called}
defined $called $Carp::CarpInternal{$called}
Truth table0%0/3
A and B
A= defined $calledB= $Carp::CarpInternal{$called}
ABresult
0X0
100
111
663 0 ▶ redo unless 0 > --$lvl;
Branch: 1 branch
BranchTrueFalseTotal
unless 0 > --$lvl 0 0 0
664 0 last;
665 }
666 else {
667 0 return 0;
668 }
669 }
670 0 ▶ redo if $Internal{$caller};
Branch: 1 branch
BranchTrueFalseTotal
if $Carp::Internal{$caller} 0 0 0
671 0 ▶ redo if $CarpInternal{$caller};
Branch: 1 branch
BranchTrueFalseTotal
if $Carp::CarpInternal{$caller} 0 0 0
672 0 ▶ redo if $CarpInternal{$called};
Branch: 1 branch
BranchTrueFalseTotal
if $Carp::CarpInternal{$called} 0 0 0
673 0 ▶ redo if trusts( $called, $caller, $cache );
Branch: 1 branch
BranchTrueFalseTotal
if trusts($called, $caller, $cache) 0 0 0
674 0 ▶ redo if trusts( $caller, $called, $cache );
Branch: 1 branch
BranchTrueFalseTotal
if trusts($caller, $called, $cache) 0 0 0
675 0 ▶ redo unless 0 > --$lvl;
Branch: 1 branch
BranchTrueFalseTotal
unless 0 > --$lvl 0 0 0
676 }
677 0 return $i - 1;
678 }
679  
680 sub shortmess_heavy {
681 0 ▶ return longmess_heavy(@_) if $Verbose;
Subroutine shortmess_heavy: not called CC=4 SCAR=30.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if $Carp::Verbose 0 0 0
682 0 ▶ return @_ if ref( $_[0] ); # don't break references as exceptions
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[0] 0 0 0
683 0 my $i = short_error_loc();
684 0 ▶ if ($i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i) { } 0 0 0
685 0 ret_summary( $i, @_ );
686 }
687 else {
688 0 longmess_heavy(@_);
689 }
690 }
691  
692 # If a string is too long, trims it with ...
693 sub str_len_trim {
694 0 ▶ my $str = shift;
Subroutine str_len_trim: not called CC=4 SCAR=30.0
Pod undocumented
695 0 ▶ my $max = shift || 0;
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
696 0 ▶ if ( 2 < $max and $max < length($str) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (2 < $max and $max < length $str) 0 0 0
Condition0%0/3
2 < $max and $max < length $str
!ll&&!rl&&r
000
MC/DC0%0/2
2 < $max and $max < length $str
2 < $max $max < length $str
Truth table0%0/3
A and B
A= 2 < $maxB= $max < length $str
ABresult
0X0
100
111
697 0 substr( $str, $max - 3 ) = '...';
698 }
699 0 return $str;
700 }
701  
702 # Takes two packages and an optional cache. Says whether the
703 # first inherits from the second.
704 #
705 # Recursive versions of this have to work to avoid certain
706 # possible endless loops, and when following long chains of
707 # inheritance are less efficient.
708 sub trusts {
709 0 ▶ my $child = shift;
Subroutine trusts: not called CC=4 SCAR=30.0
Pod undocumented
710 0 my $parent = shift;
711 0 my $cache = shift;
712 0 my ( $known, $partial ) = get_status( $cache, $child );
713  
714 # Figure out consequences until we have an answer
715 0 ▶ while ( @$partial and not exists $known->{$parent} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$partial and not exists $known->{$parent}) 0 0 0
Condition0%0/3
@$partial and not exists $known->{$parent}
!ll&&!rl&&r
000
MC/DC0%0/2
@$partial and not exists $known->{$parent}
@$partial not exists $known->{$parent}
Truth table0%0/3
A and not(B)
A= @$partialB= not exists $known->{$parent}
ABresult
0X0
100
111
716 0 my $anc = shift @$partial;
717 0 ▶ next if exists $known->{$anc};
Branch: 1 branch
BranchTrueFalseTotal
if exists $known->{$anc} 0 0 0
718 0 $known->{$anc}++;
719 0 my ( $anc_knows, $anc_partial ) = get_status( $cache, $anc );
720 0 my @found = keys %$anc_knows;
721 0 @$known{@found} = ();
722 0 push @$partial, @$anc_partial;
723 }
724 0 return exists $known->{$parent};
725 }
726  
727 # Takes a package and gives a list of those trusted directly
728 sub trusts_directly {
729 0 ▶ my $class = shift;
Subroutine trusts_directly: not called CC=6 SCAR=37.4
Pod undocumented
730 no strict 'refs';
731 0 my $stash = \%{"$class\::"};
732 0 for my $var (qw/ CARP_NOT ISA /) {
733 # Don't try using the variable until we know it exists,
734 # to avoid polluting the caller's namespace.
735 0 ▶ if ( $stash->{$var} && ref \$stash->{$var} eq 'GLOB'
Branch: 1 branch
BranchTrueFalseTotal
if ($stash->{$var} and ref \$stash->{$var} eq "GLOB" and *{$stash->{$var};}{"ARRAY"} and @{$stash->{$var};}) 0 0 0
Condition0%0/8
$stash->{$var} and ref \$stash->{$var} eq "GLOB" and *{$stash->{$var};}{"ARRAY"} and @{$stash->{$var};}
!ll&&!rl&&r
000
$stash->{$var} and ref \$stash->{$var} eq "GLOB" and *{$stash->{$var};}{"ARRAY"}
!ll
00
$stash->{$var} and ref \$stash->{$var} eq "GLOB"
!ll&&!rl&&r
000
MC/DC0%0/3
$stash->{$var} and ref \$stash->{$var} eq "GLOB" and *{$stash->{$var};}{"ARRAY"} and @{$stash->{$var};}
$stash->{$var} ref \$stash->{$var} eq "GLOB" @{$stash->{$var};}
Truth table0%0/4
A and B and C
A= $stash->{$var}B= ref \$stash->{$var} eq "GLOB"C= @{$stash->{$var};}
ABCresult
0XX0
10X0
1100
1111
736 0 && *{$stash->{$var}}{ARRAY} && @{$stash->{$var}} ) {
737 0 return @{$stash->{$var}}
738 }
739 }
740 0 return;
741 }
742  
743 if(!defined($warnings::VERSION) ||
744 do { no warnings "numeric"; $warnings::VERSION < 1.03 }) {
745 # Very old versions of warnings.pm import from Carp. This can go
746 # wrong due to the circular dependency. If Carp is invoked before
747 # warnings, then Carp starts by loading warnings, then warnings
748 # tries to import from Carp, and gets nothing because Carp is in
749 # the process of loading and hasn't defined its import method yet.
750 # So we work around that by manually exporting to warnings here.
751 no strict "refs";
752 *{"warnings::$_"} = \&$_ foreach @EXPORT;
753 }
754  
755 1;
756  
757 __END__
« /usr/local/lib/perl5/5.44.0/x86_64-linux/File/Spec/Unix.pm ↑ Summary /usr/local/lib/perl5/5.44.0/feature.pm »