line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Rose::DBx::Bouquet::Config; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Exporter; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
81
|
|
9
|
1
|
|
|
1
|
|
1253
|
use Config::IniFiles; |
|
1
|
|
|
|
|
37839
|
|
|
1
|
|
|
|
|
624
|
|
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 Rose::DBx::Bouquet::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.04'; |
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_exclude |
58
|
|
|
|
|
|
|
{ |
59
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
return $$self{'config'} -> val($$self{'section'}, 'exclude'); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} # End of get_exclude. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# ----------------------------------------------- |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub get_output_dir |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return $$self{'config'} -> val($$self{'section'}, 'output_dir'); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} # End of get_output_dir. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# ----------------------------------------------- |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub get_tmpl_path |
78
|
|
|
|
|
|
|
{ |
79
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
return $$self{'config'} -> val($$self{'section'}, 'tmpl_path'); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} # End of get_tmpl_path. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# ----------------------------------------------- |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub get_verbose |
88
|
|
|
|
|
|
|
{ |
89
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
return $$self{'config'} -> val($$self{'section'}, 'verbose'); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
} # End of get_verbose. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# ----------------------------------------------- |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub new |
98
|
|
|
|
|
|
|
{ |
99
|
0
|
|
|
0
|
0
|
|
my($class, %arg) = @_; |
100
|
0
|
|
|
|
|
|
my($self) = bless({}, $class); |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
for my $attr_name ($self -> _standard_keys() ) |
103
|
|
|
|
|
|
|
{ |
104
|
0
|
|
|
|
|
|
my($arg_name) = $attr_name =~ /^_(.*)/; |
105
|
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
|
if (exists($arg{$arg_name}) ) |
107
|
|
|
|
|
|
|
{ |
108
|
0
|
|
|
|
|
|
$$self{$attr_name} = $arg{$arg_name}; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
else |
111
|
|
|
|
|
|
|
{ |
112
|
0
|
|
|
|
|
|
$$self{$attr_name} = $self -> _default_for($attr_name); |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
my($name) = '.htrose.bouquet.conf'; |
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
my($path); |
119
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
for (keys %INC) |
121
|
|
|
|
|
|
|
{ |
122
|
0
|
0
|
|
|
|
|
next if ($_ !~ m|Rose/DBx/Bouquet/Config.pm|); |
123
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
($path = $INC{$_}) =~ s/Config.pm/$name/; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
$$self{'config'} = Config::IniFiles -> new(-file => $path); |
128
|
0
|
|
|
|
|
|
$$self{'section'} = 'Rose::DBx::Bouquet'; |
129
|
|
|
|
|
|
|
|
130
|
0
|
0
|
|
|
|
|
if (! $$self{'config'} -> SectionExists($$self{'section'}) ) |
131
|
|
|
|
|
|
|
{ |
132
|
0
|
|
|
|
|
|
Carp::croak "Config file '$path' does not contain the section [$$self{'section'}]"; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
return $self; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
} # End of new. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# -------------------------------------------------- |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
1; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 NAME |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
C - A helper for Rose::DBx::Bouquet |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 Synopsis |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
See docs for Rose::DBx::Bouquet. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 Description |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
C is a pure Perl module. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
See docs for C. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 Constructor and initialization |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Auto-generated code will create objects of type C. You don't need to. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 Method: get_exclude() |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Return the value of 'exclude' from the config file lib/Rose/DBx/Bouquet/.htrose.bouquet.conf. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 Method: get_output_dir() |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Return the value of 'output_dir' from the config file lib/Rose/DBx/Bouquet/.htrose.bouquet.conf. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 Method: get_tmpl_path() |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Return the value of 'tmpl_path' from the config file lib/Rose/DBx/Bouquet/.htrose.bouquet.conf. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head1 Method: get_verbose() |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Return the value of 'verbose' from the config file lib/Rose/DBx/Bouquet/.htrose.bouquet.conf. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 Author |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
C was written by Ron Savage Iron@savage.net.auE> in 2008. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Home page: http://savage.net.au/index.html |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 Copyright |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Australian copyright (c) 2008, Ron Savage. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
All Programs of mine are 'OSI Certified Open Source Software'; |
188
|
|
|
|
|
|
|
you can redistribute them and/or modify them under the terms of |
189
|
|
|
|
|
|
|
The Artistic License, a copy of which is available at: |
190
|
|
|
|
|
|
|
http://www.opensource.org/licenses/index.html |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=cut |