line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Metadata::CoreList::Config; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1138
|
use Config::Tiny; |
|
3
|
|
|
|
|
2362
|
|
|
3
|
|
|
|
|
78
|
|
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
1191
|
use File::HomeDir; |
|
3
|
|
|
|
|
12352
|
|
|
3
|
|
|
|
|
180
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
1596
|
use Moo; |
|
3
|
|
|
|
|
29168
|
|
|
3
|
|
|
|
|
22
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
4542
|
use Path::Class; |
|
3
|
|
|
|
|
57144
|
|
|
3
|
|
|
|
|
167
|
|
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
1505
|
use Types::Standard qw/Any Str/; |
|
3
|
|
|
|
|
271745
|
|
|
3
|
|
|
|
|
40
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has config => |
14
|
|
|
|
|
|
|
( |
15
|
|
|
|
|
|
|
default => sub{return ''}, |
16
|
|
|
|
|
|
|
is => 'rw', |
17
|
|
|
|
|
|
|
isa => Any, |
18
|
|
|
|
|
|
|
required => 0, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has config_file_path => |
22
|
|
|
|
|
|
|
( |
23
|
|
|
|
|
|
|
default => sub{return ''}, |
24
|
|
|
|
|
|
|
is => 'rw', |
25
|
|
|
|
|
|
|
isa => Any, |
26
|
|
|
|
|
|
|
required => 0, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has section => |
30
|
|
|
|
|
|
|
( |
31
|
|
|
|
|
|
|
default => sub{return ''}, |
32
|
|
|
|
|
|
|
is => 'rw', |
33
|
|
|
|
|
|
|
isa => Any, |
34
|
|
|
|
|
|
|
required => 0, |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
our $VERSION = '1.09'; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# ----------------------------------------------- |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub BUILD |
42
|
|
|
|
|
|
|
{ |
43
|
2
|
|
|
2
|
0
|
55
|
my($self) = @_; |
44
|
|
|
|
|
|
|
|
45
|
2
|
50
|
|
|
|
39
|
if (! $self -> config_file_path) |
46
|
|
|
|
|
|
|
{ |
47
|
2
|
|
|
|
|
42
|
$self -> config_file_path(Path::Class::file(File::HomeDir -> my_dist_config('Module-Metadata-CoreList'), '.htmodule.metadata.corelist.conf') ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
2
|
|
|
|
|
735
|
$self -> read; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} # End of BUILD. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# ----------------------------------------------- |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub read |
57
|
|
|
|
|
|
|
{ |
58
|
2
|
|
|
2
|
0
|
7
|
my($self) = @_; |
59
|
2
|
|
|
|
|
32
|
my($path) = $self -> config_file_path; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Check [global]. |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
32
|
$self -> config(Config::Tiny -> read($path) ); |
64
|
|
|
|
|
|
|
|
65
|
2
|
50
|
|
|
|
947
|
if (Config::Tiny -> errstr) |
66
|
|
|
|
|
|
|
{ |
67
|
0
|
|
|
|
|
0
|
die Config::Tiny -> errstr; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
2
|
|
|
|
|
47
|
$self -> section('global'); |
71
|
|
|
|
|
|
|
|
72
|
2
|
50
|
|
|
|
56
|
if (! ${$self -> config}{$self -> section}) |
|
2
|
|
|
|
|
29
|
|
73
|
|
|
|
|
|
|
{ |
74
|
0
|
|
|
|
|
0
|
die "Config file '$path' does not contain the section [@{[$self -> section]}]\n"; |
|
0
|
|
|
|
|
0
|
|
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# Check [x] where x is host=x within [global]. |
78
|
|
|
|
|
|
|
|
79
|
2
|
|
|
|
|
48
|
$self -> section(${$self -> config}{$self -> section}{'host'}); |
|
2
|
|
|
|
|
28
|
|
80
|
|
|
|
|
|
|
|
81
|
2
|
50
|
|
|
|
77
|
if (! ${$self -> config}{$self -> section}) |
|
2
|
|
|
|
|
28
|
|
82
|
|
|
|
|
|
|
{ |
83
|
0
|
|
|
|
|
0
|
die "Config file '$path' does not contain the section [@{[$self -> section]}]\n"; |
|
0
|
|
|
|
|
0
|
|
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Move desired section into config, so caller can just use $self -> config to get a hashref. |
87
|
|
|
|
|
|
|
|
88
|
2
|
|
|
|
|
45
|
$self -> config(${$self -> config}{$self -> section}); |
|
2
|
|
|
|
|
28
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
} # End of read. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# -------------------------------------------------- |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 NAME |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
L - Cross-check Build.PL/Makefile.PL with Module::CoreList |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 Synopsis |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
See L. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 Description |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
L is a pure Perl module. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
It's a helper for L, to load the config file .htmodule.metadata.corelist.conf |
109
|
|
|
|
|
|
|
from a directory found by L. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
The config file is shipped in the config/ directory of the distro, and is copied to its final destination |
112
|
|
|
|
|
|
|
during installation of L. You can run scripts/copy.config.pl to copy the file |
113
|
|
|
|
|
|
|
manually. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 Constructor and initialization |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
new(...) returns an object of type L. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This is the class's contructor. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Usage: C<< Module::Metadata::CoreList::Config -> new >>. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This method takes no options. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 Methods |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 config() |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Returns a hashref of config options. Used like this: |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
my($config) = Module::Metadata::CoreList::Config -> new -> config; |
132
|
|
|
|
|
|
|
my($template_path) = $$config{template_path}; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 Author |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
L was written by Ron Savage Iron@savage.net.auE> in 2011. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Home page: L. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 Copyright |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Australian copyright (c) 2011, Ron Savage. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
All Programs of mine are 'OSI Certified Open Source Software'; |
145
|
|
|
|
|
|
|
you can redistribute them and/or modify them under the terms of |
146
|
|
|
|
|
|
|
The Artistic License, a copy of which is available at: |
147
|
|
|
|
|
|
|
http://www.opensource.org/licenses/index.html |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |