line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geoffrey::Utils; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
3491
|
use utf8; |
|
17
|
|
|
|
|
88
|
|
|
17
|
|
|
|
|
132
|
|
4
|
17
|
|
|
17
|
|
735
|
use 5.016; |
|
17
|
|
|
|
|
61
|
|
5
|
17
|
|
|
17
|
|
95
|
use strict; |
|
17
|
|
|
|
|
41
|
|
|
17
|
|
|
|
|
516
|
|
6
|
17
|
|
|
17
|
|
2461
|
use Readonly; |
|
17
|
|
|
|
|
15790
|
|
|
17
|
|
|
|
|
1078
|
|
7
|
17
|
|
|
17
|
|
111
|
use warnings; |
|
17
|
|
|
|
|
38
|
|
|
17
|
|
|
|
|
15272
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$Geoffrey::Utils::VERSION = '0.000204'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Readonly::Scalar our $INT_64BIT_SIGNED => 9_223_372_036_854_775_807; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub replace_spare { |
14
|
61
|
|
|
61
|
1
|
1195
|
my ( $string, $options ) = @_; |
15
|
61
|
100
|
|
|
|
191
|
if ( !$string ) { |
16
|
1
|
|
|
|
|
481
|
require Geoffrey::Exception::RequiredValue; |
17
|
1
|
|
|
|
|
5
|
Geoffrey::Exception::RequiredValue::throw_common( 'String to replace', __PACKAGE__ . '::replace_spare' ); |
18
|
|
|
|
|
|
|
} |
19
|
60
|
50
|
|
|
|
163
|
eval { $string =~ s/\{(\d+)\}/$options->[$1]/g; } or do { }; |
|
60
|
|
|
|
|
1000
|
|
20
|
60
|
|
|
|
|
299
|
return $string; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub add_schema { |
24
|
14
|
|
|
14
|
1
|
34
|
my ($s_string) = @_; |
25
|
14
|
100
|
|
|
|
68
|
return q// unless $s_string; |
26
|
13
|
|
|
|
|
158
|
return qq~$s_string.~; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub add_name { |
30
|
8
|
|
|
8
|
1
|
1775
|
my ($hr_params) = @_; |
31
|
8
|
100
|
|
|
|
55
|
return $hr_params->{name} if $hr_params->{name}; |
32
|
3
|
|
|
|
|
9
|
my @name_values = ( $hr_params->{prefix} ); |
33
|
3
|
100
|
|
|
|
43
|
push @name_values, $hr_params->{context} if $hr_params->{context}; |
34
|
3
|
|
|
|
|
10
|
push @name_values, time; |
35
|
3
|
|
|
|
|
34
|
return join q/_/, @name_values; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub obj_from_name { |
39
|
56
|
|
|
56
|
1
|
524
|
my $s_module_name = shift; |
40
|
56
|
100
|
|
|
|
140
|
if ( !$s_module_name ) { |
41
|
1
|
|
|
|
|
574
|
require Geoffrey::Exception::RequiredValue; |
42
|
1
|
|
|
|
|
11
|
Geoffrey::Exception::RequiredValue::throw_package_name('obj_from_name'); |
43
|
|
|
|
|
|
|
} |
44
|
55
|
|
|
|
|
4428
|
my $return_eval = eval qq~require $s_module_name~; |
45
|
55
|
100
|
|
|
|
284
|
if ( !$return_eval ) { |
46
|
2
|
|
|
|
|
9
|
require Geoffrey::Exception::General; |
47
|
2
|
|
|
|
|
11
|
Geoffrey::Exception::General::throw_eval($@); |
48
|
|
|
|
|
|
|
} |
49
|
53
|
|
|
|
|
352
|
return $s_module_name->new(@_); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub converter_obj_from_name { |
53
|
3
|
|
|
3
|
1
|
9
|
my $s_converter_name = shift; |
54
|
3
|
|
|
|
|
11
|
return obj_from_name( 'Geoffrey::Converter::' . $s_converter_name ); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub action_obj_from_name { |
58
|
49
|
|
|
49
|
1
|
113
|
my $s_action_name = shift; |
59
|
49
|
|
|
|
|
187
|
return obj_from_name( 'Geoffrey::Action::' . $s_action_name, @_ ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub changelog_io_from_name { |
63
|
3
|
|
|
3
|
1
|
7
|
my $s_file_name = shift; |
64
|
3
|
|
|
|
|
16
|
return obj_from_name( 'Geoffrey::Changelog::' . $s_file_name ); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub parse_package_sub { |
68
|
49
|
|
|
49
|
1
|
118
|
my ($s_action) = @_; |
69
|
49
|
|
|
|
|
281
|
my @a_action = split /\./, lc $s_action; |
70
|
49
|
|
|
|
|
137
|
my $s_sub = pop @a_action; |
71
|
49
|
|
|
|
|
150
|
return ( $s_sub, join q//, map { ucfirst } split /_/, ( join q/::/, map { ucfirst } @a_action ) ); |
|
55
|
|
|
|
|
280
|
|
|
63
|
|
|
|
|
341
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub to_lowercase { |
75
|
7
|
|
|
7
|
1
|
24
|
my ($ur_entry) = @_; |
76
|
7
|
100
|
|
|
|
31
|
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
|
|
|
|
|
2
|
for my $s_key ( sort keys %{$ur_entry} ) { |
|
1
|
|
|
|
|
11
|
|
82
|
8
|
|
|
|
|
15
|
my $ur_value = delete $ur_entry->{$s_key}; |
83
|
8
|
100
|
|
|
|
16
|
next unless $ur_value; |
84
|
7
|
50
|
|
|
|
23
|
$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
|
|
|
|
|
4
|
return $ur_entry; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; # End of Geoffrey::Utils |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |