line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Application::Bouquet::Rose::Config; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
27
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Exporter; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
68
|
|
9
|
1
|
|
|
1
|
|
3418
|
use Config::IniFiles; |
|
1
|
|
|
|
|
49728
|
|
|
1
|
|
|
|
|
665
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
14
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
15
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# This allows declaration use CGI::Application::Bouquet::Rose::Config ':all'; |
18
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
19
|
|
|
|
|
|
|
# will save memory. |
20
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
) ] ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our @EXPORT = qw( |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
our $VERSION = '1.05'; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# ----------------------------------------------- |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Encapsulated class data. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
{ |
36
|
|
|
|
|
|
|
my(%_attr_data) = |
37
|
|
|
|
|
|
|
( |
38
|
|
|
|
|
|
|
_verbose => 0, |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _default_for |
42
|
|
|
|
|
|
|
{ |
43
|
0
|
|
|
0
|
|
|
my($self, $attr_name) = @_; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
$_attr_data{$attr_name}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _standard_keys |
49
|
|
|
|
|
|
|
{ |
50
|
0
|
|
|
0
|
|
|
sort keys %_attr_data; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} # End of Encapsulated class data. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# ----------------------------------------------- |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub get_docroot |
58
|
|
|
|
|
|
|
{ |
59
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
return $$self{'config'} -> val($$self{'section'}, 'docroot'); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} # End of get_docroot. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# ----------------------------------------------- |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub get_exclude |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return $$self{'config'} -> val($$self{'section'}, 'exclude'); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} # End of get_exclude. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# ----------------------------------------------- |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub get_output_dir |
78
|
|
|
|
|
|
|
{ |
79
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
return $$self{'config'} -> val($$self{'section'}, 'output_dir'); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} # End of get_output_dir. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# ----------------------------------------------- |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub get_tmpl_path |
88
|
|
|
|
|
|
|
{ |
89
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
return $$self{'config'} -> val($$self{'section'}, 'tmpl_path'); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
} # End of get_tmpl_path. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# ----------------------------------------------- |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub get_verbose |
98
|
|
|
|
|
|
|
{ |
99
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
return $$self{'config'} -> val($$self{'section'}, 'verbose'); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
} # End of get_verbose. |
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) = '.htcgi.bouquet.conf'; |
127
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
my($path); |
129
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
|
for (keys %INC) |
131
|
|
|
|
|
|
|
{ |
132
|
0
|
0
|
|
|
|
|
next if ($_ !~ m|CGI/Application/Bouquet/Rose/Config.pm|); |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
($path = $INC{$_}) =~ s/Config.pm/$name/; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
$$self{'config'} = Config::IniFiles -> new(-file => $path); |
138
|
0
|
|
|
|
|
|
$$self{'section'} = 'CGI::Application::Bouquet::Rose'; |
139
|
|
|
|
|
|
|
|
140
|
0
|
0
|
|
|
|
|
if (! $$self{'config'} -> SectionExists($$self{'section'}) ) |
141
|
|
|
|
|
|
|
{ |
142
|
0
|
|
|
|
|
|
Carp::croak "Config file '$path' does not contain the section [$$self{'section'}]"; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
return $self; |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
} # End of new. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
# -------------------------------------------------- |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
1; |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 NAME |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
C - A helper for CGI::Application::Bouquet::Rose |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 Synopsis |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
See docs for CGI::Application::Bouquet::Rose. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 Description |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
C is a pure Perl module. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
See docs for C. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 Constructor and initialization |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Auto-generated code will create objects of type C. You don't need to. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 Method: get_doc_root() |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Return the value of 'doc_root' from the config file lib/CGI/Application/Bouquet/Rose/.htcgi.bouquet.conf. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 Method: get_exclude() |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Return the value of 'exclude' from the config file lib/CGI/Application/Bouquet/Rose/.htcgi.bouquet.conf. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 Method: get_output_dir() |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Return the value of 'output_dir' from the config file lib/CGI/Application/Bouquet/Rose/.htcgi.bouquet.conf. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 Method: get_tmpl_path() |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Return the value of 'tmpl_path' from the config file lib/CGI/Application/Bouquet/Rose/.htcgi.bouquet.conf. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 Method: get_verbose() |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Return the value of 'verbose' from the config file lib/CGI/Application/Bouquet/Rose/.htcgi.bouquet.conf. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 Author |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
C was written by Ron Savage Iron@savage.net.auE> in 2008. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Home page: http://savage.net.au/index.html |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head1 Copyright |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Australian copyright (c) 2008, Ron Savage. |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
All Programs of mine are 'OSI Certified Open Source Software'; |
202
|
|
|
|
|
|
|
you can redistribute them and/or modify them under the terms of |
203
|
|
|
|
|
|
|
The Artistic License, a copy of which is available at: |
204
|
|
|
|
|
|
|
http://www.opensource.org/licenses/index.html |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=cut |