line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geoffrey::Utils; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
3672
|
use utf8; |
|
17
|
|
|
|
|
50
|
|
|
17
|
|
|
|
|
120
|
|
4
|
17
|
|
|
17
|
|
715
|
use 5.016; |
|
17
|
|
|
|
|
55
|
|
5
|
17
|
|
|
17
|
|
90
|
use strict; |
|
17
|
|
|
|
|
33
|
|
|
17
|
|
|
|
|
483
|
|
6
|
17
|
|
|
17
|
|
2108
|
use Readonly; |
|
17
|
|
|
|
|
15187
|
|
|
17
|
|
|
|
|
985
|
|
7
|
17
|
|
|
17
|
|
107
|
use warnings; |
|
17
|
|
|
|
|
45
|
|
|
17
|
|
|
|
|
14862
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$Geoffrey::Utils::VERSION = '0.000203'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Readonly::Scalar our $INT_64BIT_SIGNED => 9_223_372_036_854_775_807; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub replace_spare { |
14
|
61
|
|
|
61
|
1
|
1279
|
my ( $string, $options ) = @_; |
15
|
61
|
100
|
|
|
|
169
|
if ( !$string ) { |
16
|
1
|
|
|
|
|
515
|
require Geoffrey::Exception::RequiredValue; |
17
|
1
|
|
|
|
|
6
|
Geoffrey::Exception::RequiredValue::throw_common( 'String to replace', __PACKAGE__ . '::replace_spare' ); |
18
|
|
|
|
|
|
|
} |
19
|
60
|
50
|
|
|
|
108
|
eval { $string =~ s/\{(\d+)\}/$options->[$1]/g; } or do { }; |
|
60
|
|
|
|
|
911
|
|
20
|
60
|
|
|
|
|
295
|
return $string; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub add_schema { |
24
|
14
|
|
|
14
|
1
|
44
|
my ($s_string) = @_; |
25
|
14
|
100
|
|
|
|
63
|
return q// unless $s_string; |
26
|
13
|
|
|
|
|
135
|
return qq~$s_string.~; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub add_name { |
30
|
8
|
|
|
8
|
1
|
1988
|
my ($hr_params) = @_; |
31
|
8
|
100
|
|
|
|
61
|
return $hr_params->{name} if $hr_params->{name}; |
32
|
3
|
|
|
|
|
10
|
my @name_values = ( $hr_params->{prefix} ); |
33
|
3
|
100
|
|
|
|
13
|
push @name_values, $hr_params->{context} if $hr_params->{context}; |
34
|
3
|
|
|
|
|
7
|
push @name_values, time; |
35
|
3
|
|
|
|
|
30
|
return join q/_/, @name_values; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub obj_from_name { |
39
|
56
|
|
|
56
|
1
|
507
|
my $s_module_name = shift; |
40
|
56
|
100
|
|
|
|
143
|
if ( !$s_module_name ) { |
41
|
1
|
|
|
|
|
529
|
require Geoffrey::Exception::RequiredValue; |
42
|
1
|
|
|
|
|
4
|
Geoffrey::Exception::RequiredValue::throw_package_name('obj_from_name'); |
43
|
|
|
|
|
|
|
} |
44
|
55
|
|
|
|
|
4338
|
my $return_eval = eval qq~require $s_module_name~; |
45
|
55
|
100
|
|
|
|
286
|
if ( !$return_eval ) { |
46
|
2
|
|
|
|
|
11
|
require Geoffrey::Exception::General; |
47
|
2
|
|
|
|
|
12
|
Geoffrey::Exception::General::throw_eval($@); |
48
|
|
|
|
|
|
|
} |
49
|
53
|
|
|
|
|
349
|
return $s_module_name->new(@_); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub converter_obj_from_name { |
53
|
3
|
|
|
3
|
1
|
8
|
my $s_converter_name = shift; |
54
|
3
|
|
|
|
|
12
|
return obj_from_name( 'Geoffrey::Converter::' . $s_converter_name ); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub action_obj_from_name { |
58
|
49
|
|
|
49
|
1
|
96
|
my $s_action_name = shift; |
59
|
49
|
|
|
|
|
198
|
return obj_from_name( 'Geoffrey::Action::' . $s_action_name, @_ ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub changelog_io_from_name { |
63
|
3
|
|
|
3
|
1
|
8
|
my $s_file_name = shift; |
64
|
3
|
|
|
|
|
18
|
return obj_from_name( 'Geoffrey::Changelog::' . $s_file_name ); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub parse_package_sub { |
68
|
49
|
|
|
49
|
1
|
116
|
my ($s_action) = @_; |
69
|
49
|
|
|
|
|
380
|
my @a_action = split /\./, lc $s_action; |
70
|
49
|
|
|
|
|
160
|
my $s_sub = pop @a_action; |
71
|
49
|
|
|
|
|
167
|
return ( $s_sub, join q//, map { ucfirst } split /_/, ( join q/::/, map { ucfirst } @a_action ) ); |
|
55
|
|
|
|
|
288
|
|
|
63
|
|
|
|
|
344
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub to_lowercase { |
75
|
7
|
|
|
7
|
1
|
29
|
my ($ur_entry) = @_; |
76
|
7
|
100
|
|
|
|
30
|
return unless $ur_entry; |
77
|
1
|
50
|
|
|
|
5
|
if ( ref($ur_entry) eq 'ARRAY' ) { |
78
|
0
|
|
|
|
|
0
|
$_ = to_lowercase($_) for @{$ur_entry}; |
|
0
|
|
|
|
|
0
|
|
79
|
0
|
|
|
|
|
0
|
return $ur_entry; |
80
|
|
|
|
|
|
|
} |
81
|
1
|
|
|
|
|
4
|
for my $s_key ( sort keys %{$ur_entry} ) { |
|
1
|
|
|
|
|
9
|
|
82
|
8
|
|
|
|
|
13
|
my $ur_value = delete $ur_entry->{$s_key}; |
83
|
8
|
100
|
|
|
|
19
|
next unless $ur_value; |
84
|
7
|
50
|
|
|
|
25
|
$ur_entry->{ lc $s_key eq 'plain_sql' ? 'as' : lc $s_key } = |
|
|
50
|
|
|
|
|
|
85
|
|
|
|
|
|
|
ref($ur_value) =~ /(HASH|ARRAY)/ ? to_lowercase($ur_value) : $ur_value; |
86
|
|
|
|
|
|
|
} |
87
|
1
|
|
|
|
|
5
|
return $ur_entry; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; # End of Geoffrey::Utils |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |