line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Custom::Util; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
118
|
use strict; |
|
17
|
|
|
|
|
33
|
|
|
17
|
|
|
|
|
512
|
|
4
|
17
|
|
|
17
|
|
86
|
use warnings; |
|
17
|
|
|
|
|
32
|
|
|
17
|
|
|
|
|
437
|
|
5
|
17
|
|
|
17
|
|
83
|
use Carp 'cluck'; |
|
17
|
|
|
|
|
39
|
|
|
17
|
|
|
|
|
861
|
|
6
|
|
|
|
|
|
|
|
7
|
17
|
|
|
17
|
|
105
|
use base 'Exporter'; |
|
17
|
|
|
|
|
34
|
|
|
17
|
|
|
|
|
7826
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw/_array_to_hash _subname _deprecate/; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _array_to_hash { |
12
|
540
|
|
|
540
|
|
1021
|
my $array = shift; |
13
|
|
|
|
|
|
|
|
14
|
540
|
100
|
|
|
|
1571
|
return $array if ref $array eq 'HASH'; |
15
|
291
|
100
|
|
|
|
889
|
return unless $array; |
16
|
|
|
|
|
|
|
|
17
|
38
|
|
|
|
|
75
|
my $hash = {}; |
18
|
|
|
|
|
|
|
|
19
|
38
|
|
|
|
|
141
|
for (my $i = 0; $i < @$array; $i += 2) { |
20
|
38
|
|
|
|
|
86
|
my $key = $array->[$i]; |
21
|
38
|
|
|
|
|
82
|
my $f = $array->[$i + 1]; |
22
|
|
|
|
|
|
|
|
23
|
38
|
100
|
|
|
|
114
|
if (ref $key eq 'ARRAY') { |
24
|
9
|
|
|
|
|
22
|
for my $k (@$key) { $hash->{$k} = $f } |
|
18
|
|
|
|
|
56
|
|
25
|
|
|
|
|
|
|
} |
26
|
29
|
|
|
|
|
101
|
else { $hash->{$key} = $f } |
27
|
|
|
|
|
|
|
} |
28
|
38
|
|
|
|
|
98
|
return $hash; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
628
|
|
|
628
|
|
12308
|
sub _subname { '(' . (caller 1)[3] . ')' } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _deprecate { |
34
|
284
|
|
|
284
|
|
727
|
my ($deprecated_version, $message) = @_; |
35
|
|
|
|
|
|
|
|
36
|
284
|
|
100
|
|
|
1000
|
my $suppress_version = $ENV{DBIX_CUSTOM_SUPPRESS_DEPRECATION} || 0; |
37
|
|
|
|
|
|
|
|
38
|
284
|
100
|
|
|
|
2602
|
cluck "$message (Version: $deprecated_version) (" . (caller 1)[3] . ")\n" |
39
|
|
|
|
|
|
|
if $suppress_version < $deprecated_version; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
DBIx::Custom::Util - Utility class |
47
|
|
|
|
|
|
|
|