line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Custom::Util; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
90
|
use strict; |
|
17
|
|
|
|
|
27
|
|
|
17
|
|
|
|
|
410
|
|
4
|
17
|
|
|
17
|
|
70
|
use warnings; |
|
17
|
|
|
|
|
27
|
|
|
17
|
|
|
|
|
344
|
|
5
|
17
|
|
|
17
|
|
68
|
use Carp 'cluck'; |
|
17
|
|
|
|
|
28
|
|
|
17
|
|
|
|
|
709
|
|
6
|
|
|
|
|
|
|
|
7
|
17
|
|
|
17
|
|
84
|
use base 'Exporter'; |
|
17
|
|
|
|
|
28
|
|
|
17
|
|
|
|
|
5887
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw/_array_to_hash _subname _deprecate/; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _array_to_hash { |
12
|
540
|
|
|
540
|
|
804
|
my $array = shift; |
13
|
|
|
|
|
|
|
|
14
|
540
|
100
|
|
|
|
1186
|
return $array if ref $array eq 'HASH'; |
15
|
291
|
100
|
|
|
|
758
|
return unless $array; |
16
|
|
|
|
|
|
|
|
17
|
38
|
|
|
|
|
58
|
my $hash = {}; |
18
|
|
|
|
|
|
|
|
19
|
38
|
|
|
|
|
144
|
for (my $i = 0; $i < @$array; $i += 2) { |
20
|
38
|
|
|
|
|
71
|
my $key = $array->[$i]; |
21
|
38
|
|
|
|
|
85
|
my $f = $array->[$i + 1]; |
22
|
|
|
|
|
|
|
|
23
|
38
|
100
|
|
|
|
89
|
if (ref $key eq 'ARRAY') { |
24
|
9
|
|
|
|
|
16
|
for my $k (@$key) { $hash->{$k} = $f } |
|
18
|
|
|
|
|
47
|
|
25
|
|
|
|
|
|
|
} |
26
|
29
|
|
|
|
|
89
|
else { $hash->{$key} = $f } |
27
|
|
|
|
|
|
|
} |
28
|
38
|
|
|
|
|
86
|
return $hash; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
628
|
|
|
628
|
|
9597
|
sub _subname { '(' . (caller 1)[3] . ')' } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _deprecate { |
34
|
284
|
|
|
284
|
|
526
|
my ($deprecated_version, $message) = @_; |
35
|
|
|
|
|
|
|
|
36
|
284
|
|
100
|
|
|
756
|
my $suppress_version = $ENV{DBIX_CUSTOM_SUPPRESS_DEPRECATION} || 0; |
37
|
|
|
|
|
|
|
|
38
|
284
|
100
|
|
|
|
2099
|
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
|
|
|
|
|
|
|
|