line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pg::CLI::pg_config; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Pg::CLI::pg_config::VERSION = '0.11'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
1660
|
use Moose; |
|
6
|
|
|
|
|
302818
|
|
|
6
|
|
|
|
|
36
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
26369
|
use namespace::autoclean; |
|
6
|
|
|
|
|
6199
|
|
|
6
|
|
|
|
|
42
|
|
9
|
|
|
|
|
|
|
|
10
|
6
|
|
|
6
|
|
709
|
use MooseX::SemiAffordanceAccessor; |
|
6
|
|
|
|
|
8646
|
|
|
6
|
|
|
|
|
34
|
|
11
|
6
|
|
|
6
|
|
16629
|
use MooseX::Types::Moose qw( HashRef Maybe Str ); |
|
6
|
|
|
|
|
35578
|
|
|
6
|
|
|
|
|
50
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'Pg::CLI::Role::Executable'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has _config_info => ( |
16
|
|
|
|
|
|
|
is => 'ro', |
17
|
|
|
|
|
|
|
isa => HashRef [ Maybe [Str] ], |
18
|
|
|
|
|
|
|
init_arg => undef, |
19
|
|
|
|
|
|
|
lazy => 1, |
20
|
|
|
|
|
|
|
builder => '_build_config_info', |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my @attrs = qw( |
24
|
|
|
|
|
|
|
bindir |
25
|
|
|
|
|
|
|
cc |
26
|
|
|
|
|
|
|
cflags |
27
|
|
|
|
|
|
|
cflags_sl |
28
|
|
|
|
|
|
|
configure |
29
|
|
|
|
|
|
|
cppflags |
30
|
|
|
|
|
|
|
docdir |
31
|
|
|
|
|
|
|
htmldir |
32
|
|
|
|
|
|
|
includedir |
33
|
|
|
|
|
|
|
includedir_server |
34
|
|
|
|
|
|
|
ldflags |
35
|
|
|
|
|
|
|
ldflags_sl |
36
|
|
|
|
|
|
|
libdir |
37
|
|
|
|
|
|
|
libs |
38
|
|
|
|
|
|
|
localedir |
39
|
|
|
|
|
|
|
mandir |
40
|
|
|
|
|
|
|
pgxs |
41
|
|
|
|
|
|
|
pkgincludedir |
42
|
|
|
|
|
|
|
pkglibdir |
43
|
|
|
|
|
|
|
sharedir |
44
|
|
|
|
|
|
|
sysconfdir |
45
|
|
|
|
|
|
|
version |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
for my $attr (@attrs) { |
49
|
|
|
|
|
|
|
has $attr => ( |
50
|
|
|
|
|
|
|
is => 'ro', |
51
|
|
|
|
|
|
|
isa => Maybe[Str], |
52
|
|
|
|
|
|
|
init_arg => undef, |
53
|
|
|
|
|
|
|
lazy => 1, |
54
|
|
|
|
|
|
|
default => sub { $_[0]->_config_info()->{$attr} }, |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub _build_config_info { |
59
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
1
|
my %info; |
62
|
1
|
|
|
|
|
13
|
for my $line ( $self->_pg_config_output() ) { |
63
|
22
|
|
|
|
|
25
|
chomp $line; |
64
|
22
|
|
|
|
|
34
|
my ( $key, $val ) = split / = /, $line, 2; |
65
|
|
|
|
|
|
|
|
66
|
22
|
|
|
|
|
21
|
$key =~ s/-/_/; |
67
|
|
|
|
|
|
|
|
68
|
22
|
100
|
|
|
|
51
|
$info{ lc $key } = $val =~ /\S/ ? $val : undef; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
|
|
25
|
return \%info; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Separate method so it can be overridden for tests |
75
|
|
|
|
|
|
|
sub _pg_config_output { |
76
|
0
|
|
|
0
|
|
|
my $self = shift; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
my $command = $self->executable(); |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
return `$command`; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__PACKAGE__->meta()->make_immutable(); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# ABSTRACT: Wrapper for the F<psql> utility |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__END__ |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=pod |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 NAME |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Pg::CLI::pg_config - Wrapper for the F<psql> utility |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 VERSION |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
version 0.11 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 SYNOPSIS |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my $pg_config = Pg::CLI::pg_config->new(); |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
print $pg_config()->sharedir(); |
106
|
|
|
|
|
|
|
print $pg_config()->version(); |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 DESCRIPTION |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This class provides a wrapper for the F<pg_config> utility. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 METHODS |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This class provides the following methods: |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 Pg::CLI::pg_config->new() |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The constructor accepts one parameter: |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=over 4 |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item * executable |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
The path to F<pg_config>. By default, this will look for F<pg_config> in your |
125
|
|
|
|
|
|
|
path and throw an error if it cannot be found. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=back |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 Config Info Methods |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This class provides the following methods, each of which returns the relevant |
132
|
|
|
|
|
|
|
configuration info. If there was no value for the item, the method returns |
133
|
|
|
|
|
|
|
C<undef>. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=over 4 |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item * $pg_config->bindir() |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item * $pg_config->cc() |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item * $pg_config->cflags() |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * $pg_config->cflags_sl() |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item * $pg_config->configure() |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * $pg_config->cppflags() |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item * $pg_config->docdir() |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item * $pg_config->htmldir() |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item * $pg_config->includedir() |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item * $pg_config->includedir_server() |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * $pg_config->ldflags() |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item * $pg_config->ldflags_sl() |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item * $pg_config->libdir() |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=item * $pg_config->libs() |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item * $pg_config->localedir() |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item * $pg_config->mandir() |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item * $pg_config->pgxs() |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item * $pg_config->pkgincludedir() |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item * $pg_config->pkglibdir() |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item * $pg_config->sharedir() |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=item * $pg_config->sysconfdir() |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item * $pg_config->version() |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=back |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 BUGS |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
See L<Pg::CLI> for bug reporting details. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 AUTHOR |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
This software is Copyright (c) 2013 by Dave Rolsky. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
This is free software, licensed under: |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=cut |