| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CGI::Application::Util::Diff::Config; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
60
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use Config::Tiny; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
23
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use Hash::FieldHash qw/:all/; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
793
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
fieldhash my %config => 'config'; |
|
10
|
|
|
|
|
|
|
fieldhash my %section => 'section'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
|
15
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
|
16
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# This allows declaration use CGI::Application::Util::Diff::Config ':all'; |
|
19
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
|
20
|
|
|
|
|
|
|
# will save memory. |
|
21
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
) ] ); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our @EXPORT = qw( |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our $VERSION = '1.03'; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# ----------------------------------------------- |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Encapsulated class data. |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
{ |
|
38
|
|
|
|
|
|
|
my(%_attr_data) = |
|
39
|
|
|
|
|
|
|
( |
|
40
|
|
|
|
|
|
|
); |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _default_for |
|
43
|
|
|
|
|
|
|
{ |
|
44
|
0
|
|
|
0
|
|
|
my($self, $attr_name) = @_; |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
$_attr_data{$attr_name}; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _standard_keys |
|
50
|
|
|
|
|
|
|
{ |
|
51
|
0
|
|
|
0
|
|
|
keys %_attr_data; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# ----------------------------------------------- |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub get_form_action |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
return ${$self -> config()}{$self -> section()}{'form_action'}; |
|
|
0
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} # End of get_form_action. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# ----------------------------------------------- |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub get_logger |
|
68
|
|
|
|
|
|
|
{ |
|
69
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return ${$self -> config()}{$self -> section()}{'logger'}; |
|
|
0
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} # End of get_logger. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# ----------------------------------------------- |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub get_temp_dir |
|
78
|
|
|
|
|
|
|
{ |
|
79
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
return ${$self -> config()}{$self -> section()}{'temp_dir'}; |
|
|
0
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} # End of get_temp_dir. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# ----------------------------------------------- |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub get_tmpl_path |
|
88
|
|
|
|
|
|
|
{ |
|
89
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
return ${$self -> config()}{$self -> section()}{'tmpl_path'}; |
|
|
0
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
} # End of get_tmpl_path. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# ----------------------------------------------- |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub get_yui_url |
|
98
|
|
|
|
|
|
|
{ |
|
99
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
|
100
|
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
return ${$self -> config()}{$self -> section()}{'yui_url'}; |
|
|
0
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
} # End of get_yui_url. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# ----------------------------------------------- |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub new |
|
108
|
|
|
|
|
|
|
{ |
|
109
|
0
|
|
|
0
|
0
|
|
my($class, $arg) = @_; |
|
110
|
0
|
|
|
|
|
|
my($self) = bless({}, $class); |
|
111
|
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
for my $attr_name ($self -> _standard_keys() ) |
|
113
|
|
|
|
|
|
|
{ |
|
114
|
0
|
|
|
|
|
|
my($arg_name) = $attr_name =~ /^_(.*)/; |
|
115
|
|
|
|
|
|
|
|
|
116
|
0
|
0
|
|
|
|
|
if (exists($$arg{$arg_name}) ) |
|
117
|
|
|
|
|
|
|
{ |
|
118
|
0
|
|
|
|
|
|
$$self{$attr_name} = $$arg{$arg_name}; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
else |
|
121
|
|
|
|
|
|
|
{ |
|
122
|
0
|
|
|
|
|
|
$$self{$attr_name} = $self -> _default_for($attr_name); |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
my($name) = '.htutil.diff.conf'; |
|
127
|
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
my($path); |
|
129
|
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
for (keys %INC) |
|
131
|
|
|
|
|
|
|
{ |
|
132
|
0
|
0
|
|
|
|
|
next if ($_ !~ m|CGI/Application/Util/Diff/Config.pm|); |
|
133
|
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
($path = $INC{$_}) =~ s/Config.pm/$name/; |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
# Check [global]. |
|
138
|
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
$self -> config(Config::Tiny -> read($path) ); |
|
140
|
0
|
|
|
|
|
|
$self -> section('global'); |
|
141
|
|
|
|
|
|
|
|
|
142
|
0
|
0
|
|
|
|
|
if (! ${$self -> config()}{$self -> section()}) |
|
|
0
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
{ |
|
144
|
0
|
|
|
|
|
|
Carp::croak "Config file '$path' does not contain the section [@{[$self -> section()]}]"; |
|
|
0
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
# Check [x] where x is host=x within [global]. |
|
148
|
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
$self -> section(${$self -> config()}{$self -> section()}{'host'}); |
|
|
0
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
|
151
|
0
|
0
|
|
|
|
|
if (! ${$self -> config()}{$self -> section()}) |
|
|
0
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
{ |
|
153
|
0
|
|
|
|
|
|
Carp::croak "Config file '$path' does not contain the section [@{[$self -> section()]}]"; |
|
|
0
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
|
return $self; |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
} # End of new. |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
# -------------------------------------------------- |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
1; |