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