| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package # hide from PAUSE |
|
2
|
|
|
|
|
|
|
DBIx::Class::Schema::Loader::Utils; |
|
3
|
|
|
|
|
|
|
|
|
4
|
58
|
|
|
58
|
|
987040
|
use strict; |
|
|
58
|
|
|
|
|
121
|
|
|
|
58
|
|
|
|
|
2292
|
|
|
5
|
58
|
|
|
58
|
|
308
|
use warnings; |
|
|
58
|
|
|
|
|
203
|
|
|
|
58
|
|
|
|
|
5644
|
|
|
6
|
58
|
|
|
58
|
|
28231
|
use String::CamelCase 'wordsplit'; |
|
|
58
|
|
|
|
|
41286
|
|
|
|
58
|
|
|
|
|
4351
|
|
|
7
|
58
|
|
|
58
|
|
4847
|
use Carp::Clan qw/^DBIx::Class/; |
|
|
58
|
|
|
|
|
42553
|
|
|
|
58
|
|
|
|
|
406
|
|
|
8
|
58
|
|
|
58
|
|
6084
|
use List::Util 'all'; |
|
|
58
|
|
|
|
|
121
|
|
|
|
58
|
|
|
|
|
6270
|
|
|
9
|
58
|
|
|
58
|
|
5544
|
use namespace::clean; |
|
|
58
|
|
|
|
|
179075
|
|
|
|
58
|
|
|
|
|
514
|
|
|
10
|
58
|
|
|
58
|
|
17977
|
use Exporter 'import'; |
|
|
58
|
|
|
|
|
150
|
|
|
|
58
|
|
|
|
|
2279
|
|
|
11
|
58
|
|
|
58
|
|
37117
|
use Data::Dumper (); |
|
|
58
|
|
|
|
|
512273
|
|
|
|
58
|
|
|
|
|
25052
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
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/; |
|
14
|
|
|
|
|
|
|
|
|
15
|
58
|
|
|
|
|
8952
|
use constant BY_CASE_TRANSITION_V7 => |
|
16
|
58
|
|
|
58
|
|
628
|
qr/(?<=[[:lower:]\d])[\W_]*(?=[[:upper:]])|[\W_]+/; |
|
|
58
|
|
|
|
|
110
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
58
|
|
|
|
|
51735
|
use constant BY_NON_ALPHANUM => |
|
19
|
58
|
|
|
58
|
|
384
|
qr/[\W_]+/; |
|
|
58
|
|
|
|
|
119
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $LF = "\x0a"; |
|
22
|
|
|
|
|
|
|
my $CRLF = "\x0d\x0a"; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub split_name($;$) { |
|
25
|
5687
|
|
|
5687
|
0
|
258997
|
my ($name, $v) = @_; |
|
26
|
|
|
|
|
|
|
|
|
27
|
5687
|
|
100
|
|
|
20763
|
my $is_camel_case = $name =~ /[[:upper:]]/ && $name =~ /[[:lower:]]/; |
|
28
|
|
|
|
|
|
|
|
|
29
|
5687
|
100
|
66
|
|
|
28622
|
if ((not $v) || $v >= 8) { |
|
30
|
33
|
|
|
|
|
202
|
return map split(BY_NON_ALPHANUM, $_), wordsplit($name); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
5654
|
100
|
|
|
|
51479
|
return split $is_camel_case ? BY_CASE_TRANSITION_V7 : BY_NON_ALPHANUM, $name; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub dumper($) { |
|
37
|
0
|
|
|
0
|
0
|
0
|
my $val = shift; |
|
38
|
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
0
|
my $dd = Data::Dumper->new([]); |
|
40
|
0
|
|
|
|
|
0
|
$dd->Terse(1)->Indent(1)->Useqq(1)->Deparse(1)->Quotekeys(0)->Sortkeys(1); |
|
41
|
0
|
|
|
|
|
0
|
return $dd->Values([ $val ])->Dump; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub dumper_squashed($) { |
|
45
|
144
|
|
|
144
|
0
|
127140
|
my $val = shift; |
|
46
|
|
|
|
|
|
|
|
|
47
|
144
|
|
|
|
|
1593
|
my $dd = Data::Dumper->new([]); |
|
48
|
144
|
|
|
|
|
8729
|
$dd->Terse(1)->Indent(1)->Useqq(1)->Deparse(1)->Quotekeys(0)->Sortkeys(1)->Indent(0); |
|
49
|
144
|
|
|
|
|
8656
|
return $dd->Values([ $val ])->Dump; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# copied from DBIx::Class::_Util, import from there once it's released |
|
53
|
|
|
|
|
|
|
sub sigwarn_silencer { |
|
54
|
10784
|
|
|
10784
|
0
|
2085221
|
my $pattern = shift; |
|
55
|
|
|
|
|
|
|
|
|
56
|
10784
|
50
|
|
|
|
32462
|
croak "Expecting a regexp" if ref $pattern ne 'Regexp'; |
|
57
|
|
|
|
|
|
|
|
|
58
|
10784
|
|
66
|
0
|
|
46549
|
my $orig_sig_warn = $SIG{__WARN__} || sub { CORE::warn(@_) }; |
|
|
0
|
|
|
|
|
0
|
|
|
59
|
|
|
|
|
|
|
|
|
60
|
10784
|
100
|
|
92
|
|
59651
|
return sub { &$orig_sig_warn unless $_[0] =~ $pattern }; |
|
|
92
|
|
|
|
|
15117
|
|
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Copied with stylistic adjustments from List::MoreUtils::PP |
|
64
|
|
|
|
|
|
|
sub firstidx (&@) { |
|
65
|
1383
|
|
|
1383
|
0
|
2589
|
my $f = shift; |
|
66
|
1383
|
|
|
|
|
5290
|
foreach my $i (0..$#_) { |
|
67
|
1397
|
|
|
|
|
4027
|
local *_ = \$_[$i]; |
|
68
|
1397
|
100
|
|
|
|
3677
|
return $i if $f->(); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
0
|
|
|
|
|
0
|
return -1; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub uniq (@) { |
|
74
|
129
|
|
|
129
|
0
|
391
|
my %seen = (); |
|
75
|
129
|
|
|
|
|
431
|
grep { not $seen{$_}++ } @_; |
|
|
300
|
|
|
|
|
1936
|
|
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub apply (&@) { |
|
79
|
1242
|
|
|
1242
|
0
|
280509
|
my $action = shift; |
|
80
|
1242
|
|
|
|
|
4175
|
$action->() foreach my @values = @_; |
|
81
|
1242
|
50
|
|
|
|
6156
|
wantarray ? @values : $values[-1]; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub eval_package_without_redefine_warnings { |
|
85
|
1692
|
|
|
1692
|
0
|
5900
|
my ($pkg, $code) = @_; |
|
86
|
|
|
|
|
|
|
|
|
87
|
1692
|
|
|
|
|
12344
|
local $SIG{__WARN__} = sigwarn_silencer(qr/^Subroutine \S+ redefined/); |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# This hairiness is to handle people using "use warnings FATAL => 'all';" |
|
90
|
|
|
|
|
|
|
# in their custom or external content. |
|
91
|
1692
|
|
|
|
|
4564
|
my @delete_syms; |
|
92
|
1692
|
|
|
|
|
3928
|
my $try_again = 1; |
|
93
|
|
|
|
|
|
|
|
|
94
|
1692
|
|
|
|
|
6902
|
while ($try_again) { |
|
95
|
1700
|
|
|
3
|
|
178171
|
eval $code; |
|
|
3
|
|
|
3
|
|
30
|
|
|
|
3
|
|
|
2
|
|
9
|
|
|
|
3
|
|
|
1
|
|
140
|
|
|
|
3
|
|
|
1
|
|
18
|
|
|
|
3
|
|
|
1
|
|
7
|
|
|
|
3
|
|
|
|
|
244
|
|
|
|
2
|
|
|
|
|
1192
|
|
|
|
2
|
|
|
|
|
1291
|
|
|
|
2
|
|
|
|
|
25
|
|
|
|
2
|
|
|
|
|
20
|
|
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
117
|
|
|
|
2
|
|
|
|
|
14
|
|
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
194
|
|
|
|
2
|
|
|
|
|
16
|
|
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
23
|
|
|
|
1
|
|
|
|
|
12
|
|
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
50
|
|
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
96
|
|
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
13
|
|
|
96
|
|
|
|
|
|
|
|
|
97
|
1700
|
100
|
|
|
|
2160484
|
if (my ($sym) = $@ =~ /^Subroutine (\S+) redefined/) { |
|
|
|
50
|
|
|
|
|
|
|
98
|
8
|
|
|
|
|
43
|
delete $INC{ +class_path($pkg) }; |
|
99
|
8
|
|
|
|
|
31
|
push @delete_syms, $sym; |
|
100
|
|
|
|
|
|
|
|
|
101
|
8
|
|
|
|
|
30
|
foreach my $sym (@delete_syms) { |
|
102
|
58
|
|
|
58
|
|
664
|
no strict 'refs'; |
|
|
58
|
|
|
|
|
142
|
|
|
|
58
|
|
|
|
|
43552
|
|
|
103
|
11
|
|
|
|
|
27
|
undef *{"${pkg}::${sym}"}; |
|
|
11
|
|
|
|
|
275
|
|
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
elsif ($@) { |
|
107
|
0
|
0
|
|
|
|
0
|
die $@ if $@; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
else { |
|
110
|
1692
|
|
|
|
|
29098
|
$try_again = 0; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub class_path { |
|
116
|
2687
|
|
|
2687
|
0
|
6162
|
my $class = shift; |
|
117
|
|
|
|
|
|
|
|
|
118
|
2687
|
|
|
|
|
6498
|
my $class_path = $class; |
|
119
|
2687
|
|
|
|
|
18351
|
$class_path =~ s{::}{/}g; |
|
120
|
2687
|
|
|
|
|
7136
|
$class_path .= '.pm'; |
|
121
|
|
|
|
|
|
|
|
|
122
|
2687
|
|
|
|
|
13338
|
return $class_path; |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub no_warnings(&;$) { |
|
126
|
0
|
|
|
0
|
0
|
0
|
my ($code, $test_name) = @_; |
|
127
|
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
0
|
my $failed = 0; |
|
129
|
|
|
|
|
|
|
|
|
130
|
0
|
|
0
|
0
|
|
0
|
my $warn_handler = $SIG{__WARN__} || sub { warn @_ }; |
|
|
0
|
|
|
|
|
0
|
|
|
131
|
|
|
|
|
|
|
local $SIG{__WARN__} = sub { |
|
132
|
0
|
|
|
0
|
|
0
|
$failed = 1; |
|
133
|
0
|
|
|
|
|
0
|
$warn_handler->(@_); |
|
134
|
0
|
|
|
|
|
0
|
}; |
|
135
|
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
0
|
$code->(); |
|
137
|
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
0
|
Test::More::ok ((not $failed), $test_name); |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub warnings_exist(&$$) { |
|
142
|
0
|
|
|
0
|
0
|
0
|
my ($code, $re, $test_name) = @_; |
|
143
|
|
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
0
|
my $matched = 0; |
|
145
|
|
|
|
|
|
|
|
|
146
|
0
|
|
0
|
0
|
|
0
|
my $warn_handler = $SIG{__WARN__} || sub { warn @_ }; |
|
|
0
|
|
|
|
|
0
|
|
|
147
|
|
|
|
|
|
|
local $SIG{__WARN__} = sub { |
|
148
|
0
|
0
|
|
0
|
|
0
|
if ($_[0] =~ $re) { |
|
149
|
0
|
|
|
|
|
0
|
$matched = 1; |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
else { |
|
152
|
0
|
|
|
|
|
0
|
$warn_handler->(@_) |
|
153
|
|
|
|
|
|
|
} |
|
154
|
0
|
|
|
|
|
0
|
}; |
|
155
|
|
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
0
|
$code->(); |
|
157
|
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
0
|
Test::More::ok $matched, $test_name; |
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub warnings_exist_silent(&$$) { |
|
162
|
0
|
|
|
0
|
0
|
0
|
my ($code, $re, $test_name) = @_; |
|
163
|
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
0
|
my $matched = 0; |
|
165
|
|
|
|
|
|
|
|
|
166
|
0
|
0
|
|
0
|
|
0
|
local $SIG{__WARN__} = sub { $matched = 1 if $_[0] =~ $re; }; |
|
|
0
|
|
|
|
|
0
|
|
|
167
|
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
0
|
$code->(); |
|
169
|
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
0
|
Test::More::ok $matched, $test_name; |
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub slurp_file($) { |
|
174
|
110
|
|
|
110
|
0
|
5455302
|
my $file_name = shift; |
|
175
|
|
|
|
|
|
|
|
|
176
|
110
|
50
|
|
|
|
10565
|
open my $fh, '<:encoding(UTF-8)', $file_name, |
|
177
|
|
|
|
|
|
|
or croak "Can't open '$file_name' for reading: $!"; |
|
178
|
|
|
|
|
|
|
|
|
179
|
110
|
|
|
|
|
11961
|
my $data = do { local $/; <$fh> }; |
|
|
110
|
|
|
|
|
779
|
|
|
|
110
|
|
|
|
|
9886
|
|
|
180
|
|
|
|
|
|
|
|
|
181
|
110
|
|
|
|
|
4633
|
close $fh; |
|
182
|
|
|
|
|
|
|
|
|
183
|
110
|
|
|
|
|
16718
|
$data =~ s/$CRLF|$LF/\n/g; |
|
184
|
|
|
|
|
|
|
|
|
185
|
110
|
|
|
|
|
1521
|
return $data; |
|
186
|
|
|
|
|
|
|
} |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub write_file($$) { |
|
189
|
1
|
|
|
1
|
0
|
226
|
my $file_name = shift; |
|
190
|
|
|
|
|
|
|
|
|
191
|
1
|
50
|
|
|
|
195
|
open my $fh, '>:encoding(UTF-8)', $file_name, |
|
192
|
|
|
|
|
|
|
or croak "Can't open '$file_name' for writing: $!"; |
|
193
|
|
|
|
|
|
|
|
|
194
|
1
|
|
|
|
|
208
|
print $fh shift; |
|
195
|
1
|
|
|
|
|
292
|
close $fh; |
|
196
|
|
|
|
|
|
|
} |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub array_eq($$) { |
|
199
|
58
|
|
|
58
|
|
547
|
no warnings 'uninitialized'; |
|
|
58
|
|
|
|
|
133
|
|
|
|
58
|
|
|
|
|
9817
|
|
|
200
|
1051
|
|
|
1051
|
0
|
11358
|
my ($l, $r) = @_; |
|
201
|
|
|
|
|
|
|
|
|
202
|
1051
|
|
100
|
665
|
|
16508
|
return @$l == @$r && all { $l->[$_] eq $r->[$_] } 0..$#$l; |
|
|
665
|
|
|
|
|
11559
|
|
|
203
|
|
|
|
|
|
|
} |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
1; |
|
206
|
|
|
|
|
|
|
# vim:et sts=4 sw=4 tw=0: |