line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package # hide from pause |
2
|
|
|
|
|
|
|
DBIx::Class::Carp; |
3
|
|
|
|
|
|
|
|
4
|
385
|
|
|
385
|
|
2306
|
use strict; |
|
385
|
|
|
|
|
707
|
|
|
385
|
|
|
|
|
10521
|
|
5
|
385
|
|
|
385
|
|
1592
|
use warnings; |
|
385
|
|
|
|
|
812
|
|
|
385
|
|
|
|
|
10144
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# load Carp early to prevent tickling of the ::Internal stash being |
8
|
|
|
|
|
|
|
# interpreted as "Carp is already loaded" by some braindead loader |
9
|
385
|
|
|
385
|
|
1754
|
use Carp (); |
|
385
|
|
|
|
|
2973
|
|
|
385
|
|
|
|
|
236208
|
|
10
|
|
|
|
|
|
|
$Carp::Internal{ (__PACKAGE__) }++; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub __find_caller { |
13
|
3349
|
|
|
3349
|
|
44040
|
my ($skip_pattern, $class) = @_; |
14
|
|
|
|
|
|
|
|
15
|
3349
|
100
|
66
|
|
|
100286
|
my $skip_class_data = $class->_skip_namespace_frames |
16
|
|
|
|
|
|
|
if ($class and $class->can('_skip_namespace_frames')); |
17
|
|
|
|
|
|
|
|
18
|
3349
|
100
|
|
|
|
78179
|
$skip_pattern = qr/$skip_pattern|$skip_class_data/ |
19
|
|
|
|
|
|
|
if $skip_class_data; |
20
|
|
|
|
|
|
|
|
21
|
3349
|
|
|
|
|
4996
|
my $fr_num = 1; # skip us and the calling carp* |
22
|
|
|
|
|
|
|
|
23
|
3349
|
|
|
|
|
3819
|
my (@f, $origin); |
24
|
3349
|
|
|
|
|
15061
|
while (@f = caller($fr_num++)) { |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
next if |
27
|
35871
|
100
|
100
|
|
|
692755
|
( $f[3] eq '(eval)' or $f[3] =~ /::__ANON__$/ ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$origin ||= ( |
30
|
|
|
|
|
|
|
$f[3] =~ /^ (.+) :: ([^\:]+) $/x |
31
|
|
|
|
|
|
|
and |
32
|
31788
|
100
|
100
|
|
|
213206
|
! $Carp::Internal{$1} |
|
|
|
100
|
|
|
|
|
33
|
|
|
|
|
|
|
and |
34
|
|
|
|
|
|
|
############################# |
35
|
|
|
|
|
|
|
# Need a way to parameterize this for Carp::Skip |
36
|
|
|
|
|
|
|
$1 !~ /^(?: DBIx::Class::Storage::BlockRunner | Context::Preserve | Try::Tiny | Class::Accessor::Grouped | Class::C3::Componentised | Module::Runtime )$/x |
37
|
|
|
|
|
|
|
and |
38
|
|
|
|
|
|
|
$2 !~ /^(?: throw_exception | carp | carp_unique | carp_once | dbh_do | txn_do | with_deferred_fk_checks)$/x |
39
|
|
|
|
|
|
|
############################# |
40
|
|
|
|
|
|
|
) ? $f[3] : undef; |
41
|
|
|
|
|
|
|
|
42
|
31788
|
100
|
66
|
|
|
580089
|
if ( |
43
|
|
|
|
|
|
|
$f[0]->can('_skip_namespace_frames') |
44
|
|
|
|
|
|
|
and |
45
|
|
|
|
|
|
|
my $extra_skip = $f[0]->_skip_namespace_frames |
46
|
|
|
|
|
|
|
) { |
47
|
21810
|
|
|
|
|
1944599
|
$skip_pattern = qr/$skip_pattern|$extra_skip/; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
31788
|
100
|
|
|
|
317009
|
last if $f[0] !~ $skip_pattern; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
3349
|
100
|
|
|
|
13743
|
my $site = @f # if empty - nothing matched - full stack |
54
|
|
|
|
|
|
|
? "at $f[1] line $f[2]" |
55
|
|
|
|
|
|
|
: Carp::longmess() |
56
|
|
|
|
|
|
|
; |
57
|
3349
|
|
100
|
|
|
9310
|
$origin ||= '{UNKNOWN}'; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
return ( |
60
|
3349
|
100
|
|
|
|
24030
|
$site, |
61
|
|
|
|
|
|
|
$origin =~ /::/ ? "$origin(): " : "$origin: ", # cargo-cult from Carp::Clan |
62
|
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my $warn = sub { |
66
|
|
|
|
|
|
|
my ($ln, @warn) = @_; |
67
|
|
|
|
|
|
|
@warn = "Warning: something's wrong" unless @warn; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# back-compat with Carp::Clan - a warning ending with \n does |
70
|
|
|
|
|
|
|
# not include caller info |
71
|
|
|
|
|
|
|
warn ( |
72
|
|
|
|
|
|
|
@warn, |
73
|
|
|
|
|
|
|
$warn[-1] =~ /\n$/ ? '' : " $ln\n" |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
}; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub import { |
78
|
6251
|
|
|
6251
|
|
16252
|
my (undef, $skip_pattern) = @_; |
79
|
6251
|
|
|
|
|
15598
|
my $into = caller; |
80
|
|
|
|
|
|
|
|
81
|
6251
|
100
|
|
|
|
154819
|
$skip_pattern = $skip_pattern |
82
|
|
|
|
|
|
|
? qr/ ^ $into $ | $skip_pattern /x |
83
|
|
|
|
|
|
|
: qr/ ^ $into $ /x |
84
|
|
|
|
|
|
|
; |
85
|
|
|
|
|
|
|
|
86
|
385
|
|
|
385
|
|
2148
|
no strict 'refs'; |
|
385
|
|
|
|
|
666
|
|
|
385
|
|
|
|
|
118036
|
|
87
|
|
|
|
|
|
|
|
88
|
6251
|
|
|
|
|
35522
|
*{"${into}::carp"} = sub { |
89
|
172
|
|
|
172
|
|
2105
|
$warn->( |
|
|
|
|
146
|
|
|
|
90
|
|
|
|
|
|
|
__find_caller($skip_pattern, $into), |
91
|
|
|
|
|
|
|
@_ |
92
|
|
|
|
|
|
|
); |
93
|
6251
|
|
|
|
|
30490
|
}; |
94
|
|
|
|
|
|
|
|
95
|
6251
|
|
|
|
|
11104
|
my $fired = {}; |
96
|
6251
|
|
|
|
|
26626
|
*{"${into}::carp_once"} = sub { |
97
|
13
|
100
|
|
13
|
|
3902
|
return if $fired->{$_[0]}; |
98
|
9
|
|
|
|
|
42
|
$fired->{$_[0]} = 1; |
99
|
|
|
|
|
|
|
|
100
|
9
|
|
|
|
|
28
|
$warn->( |
101
|
|
|
|
|
|
|
__find_caller($skip_pattern, $into), |
102
|
|
|
|
|
|
|
@_, |
103
|
|
|
|
|
|
|
); |
104
|
6251
|
|
|
|
|
21586
|
}; |
105
|
|
|
|
|
|
|
|
106
|
6251
|
|
|
|
|
7843
|
my $seen; |
107
|
6251
|
|
|
|
|
161639
|
*{"${into}::carp_unique"} = sub { |
108
|
63
|
|
|
63
|
|
226
|
my ($ln, $calling) = __find_caller($skip_pattern, $into); |
109
|
63
|
|
|
|
|
204
|
my $msg = join ('', $calling, @_); |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# unique carping with a hidden caller makes no sense |
112
|
63
|
|
|
|
|
144
|
$msg =~ s/\n+$//; |
113
|
|
|
|
|
|
|
|
114
|
63
|
100
|
|
|
|
316
|
return if $seen->{$ln}{$msg}; |
115
|
41
|
|
|
|
|
146
|
$seen->{$ln}{$msg} = 1; |
116
|
|
|
|
|
|
|
|
117
|
41
|
|
|
|
|
118
|
$warn->( |
118
|
|
|
|
|
|
|
$ln, |
119
|
|
|
|
|
|
|
$msg, |
120
|
|
|
|
|
|
|
); |
121
|
6251
|
|
|
|
|
22352
|
}; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub unimport { |
125
|
0
|
|
|
0
|
|
|
die (__PACKAGE__ . " does not implement unimport yet\n"); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
__END__ |