line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geoffrey::Utils; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
3447
|
use utf8; |
|
17
|
|
|
|
|
47
|
|
|
17
|
|
|
|
|
120
|
|
4
|
17
|
|
|
17
|
|
695
|
use 5.016; |
|
17
|
|
|
|
|
58
|
|
5
|
17
|
|
|
17
|
|
100
|
use strict; |
|
17
|
|
|
|
|
53
|
|
|
17
|
|
|
|
|
449
|
|
6
|
17
|
|
|
17
|
|
2187
|
use Readonly; |
|
17
|
|
|
|
|
15823
|
|
|
17
|
|
|
|
|
1034
|
|
7
|
17
|
|
|
17
|
|
113
|
use warnings; |
|
17
|
|
|
|
|
33
|
|
|
17
|
|
|
|
|
15328
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$Geoffrey::Utils::VERSION = '0.000205'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Readonly::Scalar our $INT_64BIT_SIGNED => 9_223_372_036_854_775_807; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub replace_spare { |
14
|
61
|
|
|
61
|
1
|
1170
|
my ( $string, $options ) = @_; |
15
|
61
|
100
|
|
|
|
162
|
if ( !$string ) { |
16
|
1
|
|
|
|
|
476
|
require Geoffrey::Exception::RequiredValue; |
17
|
1
|
|
|
|
|
5
|
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
|
|
|
|
|
923
|
|
20
|
60
|
|
|
|
|
329
|
return $string; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub add_schema { |
24
|
14
|
|
|
14
|
1
|
32
|
my ($s_string) = @_; |
25
|
14
|
100
|
|
|
|
59
|
return q// unless $s_string; |
26
|
13
|
|
|
|
|
136
|
return qq~$s_string.~; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub add_name { |
30
|
8
|
|
|
8
|
1
|
1769
|
my ($hr_params) = @_; |
31
|
8
|
100
|
|
|
|
50
|
return $hr_params->{name} if $hr_params->{name}; |
32
|
3
|
|
|
|
|
9
|
my @name_values = ( $hr_params->{prefix} ); |
33
|
3
|
100
|
|
|
|
12
|
push @name_values, $hr_params->{context} if $hr_params->{context}; |
34
|
3
|
|
|
|
|
6
|
push @name_values, time; |
35
|
3
|
|
|
|
|
31
|
return join q/_/, @name_values; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub obj_from_name { |
39
|
56
|
|
|
56
|
1
|
475
|
my $s_module_name = shift; |
40
|
56
|
100
|
|
|
|
130
|
if ( !$s_module_name ) { |
41
|
1
|
|
|
|
|
544
|
require Geoffrey::Exception::RequiredValue; |
42
|
1
|
|
|
|
|
5
|
Geoffrey::Exception::RequiredValue::throw_package_name('obj_from_name'); |
43
|
|
|
|
|
|
|
} |
44
|
55
|
|
|
|
|
3805
|
my $return_eval = eval qq~require $s_module_name~; |
45
|
55
|
100
|
|
|
|
270
|
if ( !$return_eval ) { |
46
|
2
|
|
|
|
|
9
|
require Geoffrey::Exception::General; |
47
|
2
|
|
|
|
|
12
|
Geoffrey::Exception::General::throw_eval($@); |
48
|
|
|
|
|
|
|
} |
49
|
53
|
|
|
|
|
308
|
return $s_module_name->new(@_); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub converter_obj_from_name { |
53
|
3
|
|
|
3
|
1
|
7
|
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
|
90
|
my $s_action_name = shift; |
59
|
49
|
|
|
|
|
193
|
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
|
|
|
|
|
15
|
return obj_from_name( 'Geoffrey::Changelog::' . $s_file_name ); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub parse_package_sub { |
68
|
49
|
|
|
49
|
1
|
96
|
my ($s_action) = @_; |
69
|
49
|
|
|
|
|
206
|
my @a_action = split /\./, lc $s_action; |
70
|
49
|
|
|
|
|
100
|
my $s_sub = pop @a_action; |
71
|
49
|
|
|
|
|
128
|
return ( $s_sub, join q//, map { ucfirst } split /_/, ( join q/::/, map { ucfirst } @a_action ) ); |
|
55
|
|
|
|
|
250
|
|
|
63
|
|
|
|
|
289
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub to_lowercase { |
75
|
7
|
|
|
7
|
1
|
25
|
my ($ur_entry) = @_; |
76
|
7
|
100
|
|
|
|
29
|
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
|
|
|
|
|
10
|
|
82
|
8
|
|
|
|
|
14
|
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__ |