| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package # hide from PAUSE |
|
2
|
|
|
|
|
|
|
DBIx::Class::Schema::Loader::Utils; |
|
3
|
|
|
|
|
|
|
|
|
4
|
24
|
|
|
24
|
|
563711
|
use strict; |
|
|
24
|
|
|
|
|
134
|
|
|
|
24
|
|
|
|
|
740
|
|
|
5
|
24
|
|
|
24
|
|
148
|
use warnings; |
|
|
24
|
|
|
|
|
58
|
|
|
|
24
|
|
|
|
|
639
|
|
|
6
|
24
|
|
|
24
|
|
723
|
use Test::More; |
|
|
24
|
|
|
|
|
64025
|
|
|
|
24
|
|
|
|
|
293
|
|
|
7
|
24
|
|
|
24
|
|
17634
|
use String::CamelCase 'wordsplit'; |
|
|
24
|
|
|
|
|
13695
|
|
|
|
24
|
|
|
|
|
1423
|
|
|
8
|
24
|
|
|
24
|
|
4386
|
use Carp::Clan qw/^DBIx::Class/; |
|
|
24
|
|
|
|
|
36471
|
|
|
|
24
|
|
|
|
|
166
|
|
|
9
|
24
|
|
|
24
|
|
2564
|
use List::Util 'all'; |
|
|
24
|
|
|
|
|
62
|
|
|
|
24
|
|
|
|
|
2700
|
|
|
10
|
24
|
|
|
24
|
|
5140
|
use namespace::clean; |
|
|
24
|
|
|
|
|
157862
|
|
|
|
24
|
|
|
|
|
209
|
|
|
11
|
24
|
|
|
24
|
|
13280
|
use Exporter 'import'; |
|
|
24
|
|
|
|
|
66
|
|
|
|
24
|
|
|
|
|
642
|
|
|
12
|
24
|
|
|
24
|
|
14687
|
use Data::Dumper (); |
|
|
24
|
|
|
|
|
159843
|
|
|
|
24
|
|
|
|
|
6931
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw/split_name dumper dumper_squashed eval_package_without_redefine_warnings class_path no_warnings warnings_exist warnings_exist_silent slurp_file write_file array_eq sigwarn_silencer apply firstidx uniq/; |
|
15
|
|
|
|
|
|
|
|
|
16
|
24
|
|
|
|
|
2179
|
use constant BY_CASE_TRANSITION_V7 => |
|
17
|
24
|
|
|
24
|
|
223
|
qr/(?<=[[:lower:]\d])[\W_]*(?=[[:upper:]])|[\W_]+/; |
|
|
24
|
|
|
|
|
65
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
24
|
|
|
|
|
17789
|
use constant BY_NON_ALPHANUM => |
|
20
|
24
|
|
|
24
|
|
171
|
qr/[\W_]+/; |
|
|
24
|
|
|
|
|
63
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $LF = "\x0a"; |
|
23
|
|
|
|
|
|
|
my $CRLF = "\x0d\x0a"; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub split_name($;$) { |
|
26
|
5472
|
|
|
5472
|
0
|
18551
|
my ($name, $v) = @_; |
|
27
|
|
|
|
|
|
|
|
|
28
|
5472
|
|
100
|
|
|
15402
|
my $is_camel_case = $name =~ /[[:upper:]]/ && $name =~ /[[:lower:]]/; |
|
29
|
|
|
|
|
|
|
|
|
30
|
5472
|
100
|
66
|
|
|
22821
|
if ((not $v) || $v >= 8) { |
|
31
|
28
|
|
|
|
|
185
|
return map split(BY_NON_ALPHANUM, $_), wordsplit($name); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
5444
|
100
|
|
|
|
37886
|
return split $is_camel_case ? BY_CASE_TRANSITION_V7 : BY_NON_ALPHANUM, $name; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub dumper($) { |
|
38
|
0
|
|
|
0
|
0
|
0
|
my $val = shift; |
|
39
|
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
0
|
my $dd = Data::Dumper->new([]); |
|
41
|
0
|
|
|
|
|
0
|
$dd->Terse(1)->Indent(1)->Useqq(1)->Deparse(1)->Quotekeys(0)->Sortkeys(1); |
|
42
|
0
|
|
|
|
|
0
|
return $dd->Values([ $val ])->Dump; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub dumper_squashed($) { |
|
46
|
131
|
|
|
131
|
0
|
73527
|
my $val = shift; |
|
47
|
|
|
|
|
|
|
|
|
48
|
131
|
|
|
|
|
1116
|
my $dd = Data::Dumper->new([]); |
|
49
|
131
|
|
|
|
|
5929
|
$dd->Terse(1)->Indent(1)->Useqq(1)->Deparse(1)->Quotekeys(0)->Sortkeys(1)->Indent(0); |
|
50
|
131
|
|
|
|
|
6713
|
return $dd->Values([ $val ])->Dump; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# copied from DBIx::Class::_Util, import from there once it's released |
|
54
|
|
|
|
|
|
|
sub sigwarn_silencer { |
|
55
|
11199
|
|
|
11199
|
0
|
1756811
|
my $pattern = shift; |
|
56
|
|
|
|
|
|
|
|
|
57
|
11199
|
50
|
|
|
|
29764
|
croak "Expecting a regexp" if ref $pattern ne 'Regexp'; |
|
58
|
|
|
|
|
|
|
|
|
59
|
11199
|
|
100
|
0
|
|
40641
|
my $orig_sig_warn = $SIG{__WARN__} || sub { CORE::warn(@_) }; |
|
|
0
|
|
|
|
|
0
|
|
|
60
|
|
|
|
|
|
|
|
|
61
|
11199
|
100
|
|
92
|
|
57961
|
return sub { &$orig_sig_warn unless $_[0] =~ $pattern }; |
|
|
92
|
|
|
|
|
14400
|
|
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# Copied with stylistic adjustments from List::MoreUtils::PP |
|
65
|
|
|
|
|
|
|
sub firstidx (&@) { |
|
66
|
1307
|
|
|
1307
|
0
|
2660
|
my $f = shift; |
|
67
|
1307
|
|
|
|
|
4281
|
foreach my $i (0..$#_) { |
|
68
|
1314
|
|
|
|
|
3625
|
local *_ = \$_[$i]; |
|
69
|
1314
|
100
|
|
|
|
3465
|
return $i if $f->(); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
0
|
|
|
|
|
0
|
return -1; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub uniq (@) { |
|
75
|
126
|
|
|
126
|
0
|
316
|
my %seen = (); |
|
76
|
126
|
|
|
|
|
339
|
grep { not $seen{$_}++ } @_; |
|
|
294
|
|
|
|
|
1518
|
|
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub apply (&@) { |
|
80
|
1220
|
|
|
1220
|
0
|
14545
|
my $action = shift; |
|
81
|
1220
|
|
|
|
|
3838
|
$action->() foreach my @values = @_; |
|
82
|
1220
|
50
|
|
|
|
5713
|
wantarray ? @values : $values[-1]; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub eval_package_without_redefine_warnings { |
|
86
|
1550
|
|
|
1550
|
0
|
4461
|
my ($pkg, $code) = @_; |
|
87
|
|
|
|
|
|
|
|
|
88
|
1550
|
|
|
|
|
8120
|
local $SIG{__WARN__} = sigwarn_silencer(qr/^Subroutine \S+ redefined/); |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# This hairiness is to handle people using "use warnings FATAL => 'all';" |
|
91
|
|
|
|
|
|
|
# in their custom or external content. |
|
92
|
1550
|
|
|
|
|
3635
|
my @delete_syms; |
|
93
|
1550
|
|
|
|
|
3221
|
my $try_again = 1; |
|
94
|
|
|
|
|
|
|
|
|
95
|
1550
|
|
|
|
|
4841
|
while ($try_again) { |
|
96
|
1558
|
|
|
3
|
|
120221
|
eval $code; |
|
|
3
|
|
|
3
|
|
26
|
|
|
|
3
|
|
|
2
|
|
9
|
|
|
|
3
|
|
|
1
|
|
97
|
|
|
|
3
|
|
|
1
|
|
19
|
|
|
|
3
|
|
|
1
|
|
18
|
|
|
|
3
|
|
|
|
|
174
|
|
|
|
2
|
|
|
|
|
658
|
|
|
|
2
|
|
|
|
|
994
|
|
|
|
2
|
|
|
|
|
20
|
|
|
|
2
|
|
|
|
|
15
|
|
|
|
2
|
|
|
|
|
10
|
|
|
|
2
|
|
|
|
|
72
|
|
|
|
2
|
|
|
|
|
12
|
|
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
108
|
|
|
|
2
|
|
|
|
|
17
|
|
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
19
|
|
|
|
1
|
|
|
|
|
8
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
31
|
|
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
46
|
|
|
|
1
|
|
|
|
|
8
|
|
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
9
|
|
|
97
|
|
|
|
|
|
|
|
|
98
|
1558
|
100
|
|
|
|
1523035
|
if (my ($sym) = $@ =~ /^Subroutine (\S+) redefined/) { |
|
|
|
50
|
|
|
|
|
|
|
99
|
8
|
|
|
|
|
39
|
delete $INC{ +class_path($pkg) }; |
|
100
|
8
|
|
|
|
|
36
|
push @delete_syms, $sym; |
|
101
|
|
|
|
|
|
|
|
|
102
|
8
|
|
|
|
|
30
|
foreach my $sym (@delete_syms) { |
|
103
|
24
|
|
|
24
|
|
214
|
no strict 'refs'; |
|
|
24
|
|
|
|
|
88
|
|
|
|
24
|
|
|
|
|
18052
|
|
|
104
|
11
|
|
|
|
|
23
|
undef *{"${pkg}::${sym}"}; |
|
|
11
|
|
|
|
|
158
|
|
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
elsif ($@) { |
|
108
|
0
|
0
|
|
|
|
0
|
die $@ if $@; |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
else { |
|
111
|
1550
|
|
|
|
|
17161
|
$try_again = 0; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub class_path { |
|
117
|
2474
|
|
|
2474
|
0
|
5280
|
my $class = shift; |
|
118
|
|
|
|
|
|
|
|
|
119
|
2474
|
|
|
|
|
4625
|
my $class_path = $class; |
|
120
|
2474
|
|
|
|
|
13135
|
$class_path =~ s{::}{/}g; |
|
121
|
2474
|
|
|
|
|
5976
|
$class_path .= '.pm'; |
|
122
|
|
|
|
|
|
|
|
|
123
|
2474
|
|
|
|
|
10802
|
return $class_path; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub no_warnings(&;$) { |
|
127
|
0
|
|
|
0
|
0
|
0
|
my ($code, $test_name) = @_; |
|
128
|
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
0
|
my $failed = 0; |
|
130
|
|
|
|
|
|
|
|
|
131
|
0
|
|
0
|
0
|
|
0
|
my $warn_handler = $SIG{__WARN__} || sub { warn @_ }; |
|
|
0
|
|
|
|
|
0
|
|
|
132
|
|
|
|
|
|
|
local $SIG{__WARN__} = sub { |
|
133
|
0
|
|
|
0
|
|
0
|
$failed = 1; |
|
134
|
0
|
|
|
|
|
0
|
$warn_handler->(@_); |
|
135
|
0
|
|
|
|
|
0
|
}; |
|
136
|
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
0
|
$code->(); |
|
138
|
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
0
|
ok ((not $failed), $test_name); |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub warnings_exist(&$$) { |
|
143
|
0
|
|
|
0
|
0
|
0
|
my ($code, $re, $test_name) = @_; |
|
144
|
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
0
|
my $matched = 0; |
|
146
|
|
|
|
|
|
|
|
|
147
|
0
|
|
0
|
0
|
|
0
|
my $warn_handler = $SIG{__WARN__} || sub { warn @_ }; |
|
|
0
|
|
|
|
|
0
|
|
|
148
|
|
|
|
|
|
|
local $SIG{__WARN__} = sub { |
|
149
|
0
|
0
|
|
0
|
|
0
|
if ($_[0] =~ $re) { |
|
150
|
0
|
|
|
|
|
0
|
$matched = 1; |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
else { |
|
153
|
0
|
|
|
|
|
0
|
$warn_handler->(@_) |
|
154
|
|
|
|
|
|
|
} |
|
155
|
0
|
|
|
|
|
0
|
}; |
|
156
|
|
|
|
|
|
|
|
|
157
|
0
|
|
|
|
|
0
|
$code->(); |
|
158
|
|
|
|
|
|
|
|
|
159
|
0
|
|
|
|
|
0
|
ok $matched, $test_name; |
|
160
|
|
|
|
|
|
|
} |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub warnings_exist_silent(&$$) { |
|
163
|
0
|
|
|
0
|
0
|
0
|
my ($code, $re, $test_name) = @_; |
|
164
|
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
0
|
my $matched = 0; |
|
166
|
|
|
|
|
|
|
|
|
167
|
0
|
0
|
|
0
|
|
0
|
local $SIG{__WARN__} = sub { $matched = 1 if $_[0] =~ $re; }; |
|
|
0
|
|
|
|
|
0
|
|
|
168
|
|
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
0
|
$code->(); |
|
170
|
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
0
|
ok $matched, $test_name; |
|
172
|
|
|
|
|
|
|
} |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub slurp_file($) { |
|
175
|
107
|
|
|
107
|
0
|
685280
|
my $file_name = shift; |
|
176
|
|
|
|
|
|
|
|
|
177
|
107
|
50
|
|
|
|
7906
|
open my $fh, '<:encoding(UTF-8)', $file_name, |
|
178
|
|
|
|
|
|
|
or croak "Can't open '$file_name' for reading: $!"; |
|
179
|
|
|
|
|
|
|
|
|
180
|
107
|
|
|
|
|
10714
|
my $data = do { local $/; <$fh> }; |
|
|
107
|
|
|
|
|
740
|
|
|
|
107
|
|
|
|
|
7986
|
|
|
181
|
|
|
|
|
|
|
|
|
182
|
107
|
|
|
|
|
5613
|
close $fh; |
|
183
|
|
|
|
|
|
|
|
|
184
|
107
|
|
|
|
|
12050
|
$data =~ s/$CRLF|$LF/\n/g; |
|
185
|
|
|
|
|
|
|
|
|
186
|
107
|
|
|
|
|
1188
|
return $data; |
|
187
|
|
|
|
|
|
|
} |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub write_file($$) { |
|
190
|
1
|
|
|
1
|
0
|
145
|
my $file_name = shift; |
|
191
|
|
|
|
|
|
|
|
|
192
|
1
|
50
|
|
|
|
120
|
open my $fh, '>:encoding(UTF-8)', $file_name, |
|
193
|
|
|
|
|
|
|
or croak "Can't open '$file_name' for writing: $!"; |
|
194
|
|
|
|
|
|
|
|
|
195
|
1
|
|
|
|
|
153
|
print $fh shift; |
|
196
|
1
|
|
|
|
|
122
|
close $fh; |
|
197
|
|
|
|
|
|
|
} |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub array_eq($$) { |
|
200
|
24
|
|
|
24
|
|
227
|
no warnings 'uninitialized'; |
|
|
24
|
|
|
|
|
205
|
|
|
|
24
|
|
|
|
|
3363
|
|
|
201
|
968
|
|
|
968
|
0
|
7994
|
my ($l, $r) = @_; |
|
202
|
|
|
|
|
|
|
|
|
203
|
968
|
|
100
|
613
|
|
11096
|
return @$l == @$r && all { $l->[$_] eq $r->[$_] } 0..$#$l; |
|
|
613
|
|
|
|
|
7521
|
|
|
204
|
|
|
|
|
|
|
} |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
1; |
|
207
|
|
|
|
|
|
|
# vim:et sts=4 sw=4 tw=0: |