line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Info::Lib::OSSPUUID; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
App::Info::Lib::OSSPUUID - Information about the OSSP UUID library |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use App::Info::Lib::OSSPUUID; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $uuid = App::Info::Lib::OSSPUUID->new; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
if ($uuid->installed) { |
14
|
|
|
|
|
|
|
print "App name: ", $uuid->name, "\n"; |
15
|
|
|
|
|
|
|
print "Version: ", $uuid->version, "\n"; |
16
|
|
|
|
|
|
|
print "Bin dir: ", $uuid->bin_dir, "\n"; |
17
|
|
|
|
|
|
|
} else { |
18
|
|
|
|
|
|
|
print "Expat is not installed. :-(\n"; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
App::Info::Lib::OSSPUUID supplies information about the OSSP UUID library |
24
|
|
|
|
|
|
|
installed on the local system. It implements all of the methods defined by |
25
|
|
|
|
|
|
|
App::Info::Lib. Methods that trigger events will trigger them only the first |
26
|
|
|
|
|
|
|
time they're called (See L for documentation on handling |
27
|
|
|
|
|
|
|
events). To start over (after, say, someone has installed the OSSP UUID |
28
|
|
|
|
|
|
|
library) construct a new App::Info::Lib::OSSPUUID object to aggregate new |
29
|
|
|
|
|
|
|
meta data. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Some of the methods trigger the same events. This is due to cross-calling of |
32
|
|
|
|
|
|
|
shared subroutines. However, any one event should be triggered no more than |
33
|
|
|
|
|
|
|
once. For example, although the info event "Executing `uuid-config --version`" |
34
|
|
|
|
|
|
|
is documented for the methods C C, C, |
35
|
|
|
|
|
|
|
C, and C, rest assured that it will only be |
36
|
|
|
|
|
|
|
triggered once, by whichever of those four methods is called first. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
2
|
|
27939
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
59
|
|
41
|
2
|
|
|
2
|
|
982
|
use App::Info::Util; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
62
|
|
42
|
2
|
|
|
2
|
|
1068
|
use App::Info::Lib; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
54
|
|
43
|
2
|
|
|
2
|
|
953
|
use File::Spec::Functions 'catfile'; |
|
2
|
|
|
|
|
1005
|
|
|
2
|
|
|
|
|
159
|
|
44
|
2
|
|
|
2
|
|
11
|
use vars qw(@ISA $VERSION); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
153
|
|
45
|
|
|
|
|
|
|
@ISA = qw(App::Info::Lib); |
46
|
|
|
|
|
|
|
$VERSION = '0.57'; |
47
|
2
|
|
|
2
|
|
11
|
use constant WIN32 => $^O eq 'MSWin32'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
5442
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $u = App::Info::Util->new; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
############################################################################## |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 INTERFACE |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 Constructor |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head3 new |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my $expat = App::Info::Lib::OSSPUUID->new(@params); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Returns an App::Info::Lib::OSSPUUID object. See L for a |
62
|
|
|
|
|
|
|
complete description of argument parameters. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
When called, C searches all of the paths returned by the |
65
|
|
|
|
|
|
|
C method for one of the files returned by the |
66
|
|
|
|
|
|
|
C method. If any of is found, then the OSSP UUID library |
67
|
|
|
|
|
|
|
is assumed to be installed. Otherwise, most of the object methods will return |
68
|
|
|
|
|
|
|
C. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
B |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=over 4 |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item info |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Looking for uuid-config |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item confirm |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Path to uuid-config? |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item unknown |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Path to uuid-config? |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=back |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub new { |
91
|
|
|
|
|
|
|
# Construct the object. |
92
|
2
|
|
|
2
|
1
|
484
|
my $self = shift->SUPER::new(@_); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# Find uuid-config. |
95
|
2
|
|
|
|
|
20
|
$self->info("Looking for uuid-config"); |
96
|
|
|
|
|
|
|
|
97
|
2
|
|
|
|
|
152
|
my @paths = $self->search_bin_dirs; |
98
|
2
|
|
|
|
|
12
|
my @exes = $self->search_exe_names; |
99
|
|
|
|
|
|
|
|
100
|
2
|
100
|
|
|
|
16
|
if (my $cfg = $u->first_cat_exe(\@exes, @paths)) { |
101
|
|
|
|
|
|
|
# We found it. Confirm. |
102
|
|
|
|
|
|
|
$self->{uuid_config} = $self->confirm( |
103
|
|
|
|
|
|
|
key => 'path to uuid-config', |
104
|
|
|
|
|
|
|
prompt => "Path to uuid-config?", |
105
|
|
|
|
|
|
|
value => $cfg, |
106
|
0
|
|
|
0
|
|
0
|
callback => sub { -x }, |
107
|
1
|
|
|
|
|
12
|
error => 'Not an executable' |
108
|
|
|
|
|
|
|
); |
109
|
|
|
|
|
|
|
} else { |
110
|
|
|
|
|
|
|
# Handle an unknown value. |
111
|
|
|
|
|
|
|
$self->{uuid_config} = $self->unknown( |
112
|
|
|
|
|
|
|
key => 'path to uuid-config', |
113
|
|
|
|
|
|
|
prompt => "Path to uuid-config?", |
114
|
0
|
|
|
0
|
|
0
|
callback => sub { -x }, |
115
|
1
|
|
|
|
|
19
|
error => 'Not an executable' |
116
|
|
|
|
|
|
|
); |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
# Set up search defaults. |
120
|
2
|
100
|
|
|
|
20
|
if (exists $self->{search_uuid_names}) { |
121
|
1
|
50
|
|
|
|
6
|
$self->{search_uuid_names} = [$self->{search_uuid_names}] |
122
|
|
|
|
|
|
|
unless ref $self->{search_uuid_names} eq 'ARRAY'; |
123
|
|
|
|
|
|
|
} else { |
124
|
1
|
|
|
|
|
3
|
$self->{search_uuid_names} = []; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
2
|
|
|
|
|
17
|
return $self; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
# We'll use this code reference as a common way of collecting data. |
131
|
|
|
|
|
|
|
my $get_data = sub { |
132
|
|
|
|
|
|
|
return unless $_[0]->{uuid_config}; |
133
|
|
|
|
|
|
|
$_[0]->info(qq{Executing `"$_[0]->{uuid_config}" $_[1]`}); |
134
|
|
|
|
|
|
|
my $info = `"$_[0]->{uuid_config}" $_[1]`; |
135
|
|
|
|
|
|
|
chomp $info; |
136
|
|
|
|
|
|
|
return $info; |
137
|
|
|
|
|
|
|
}; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
############################################################################## |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 Class Method |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head3 key_name |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
my $key_name = App::Info::Lib::OSSPUUID->key_name; |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Returns the unique key name that describes this class. The value returned is |
149
|
|
|
|
|
|
|
the string "OSSP UUID". |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |
152
|
|
|
|
|
|
|
|
153
|
1
|
|
|
1
|
1
|
6
|
sub key_name { 'OSSP UUID' } |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
############################################################################## |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 Object Methods |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head3 installed |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
print "UUID is ", ($uuid->installed ? '' : 'not '), "installed.\n"; |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Returns true if the OSSP UUID library is installed, and false if it is not. |
164
|
|
|
|
|
|
|
App::Info::Lib::OSSPUUID determines whether the library is installed based on |
165
|
|
|
|
|
|
|
the presence or absence on the file system of the C application, |
166
|
|
|
|
|
|
|
searched for when C constructed the object. If the OSSP UUID library |
167
|
|
|
|
|
|
|
does not appear to be installed, then most of the other object methods will |
168
|
|
|
|
|
|
|
return empty values. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |
171
|
|
|
|
|
|
|
|
172
|
2
|
100
|
|
2
|
1
|
14
|
sub installed { $_[0]->{uuid_config} ? 1 : undef } |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
############################################################################## |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head3 name |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
my $name = $uuid->name; |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Returns the name of the library. App::Info::Lib::OSSPUUID parses the name from |
181
|
|
|
|
|
|
|
the system call C<`uuid-config --version`>. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
B |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=over 4 |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item info |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Executing `uuid-config --version` |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=item error |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
Failed to find OSSP UUID version with `uuid-config --version` |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Unable to parse name from string |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
Unable to parse version from string |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Failed to parse OSSP UUID version parts from string |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item unknown |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Enter a valid OSSP UUID version number |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=back |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=cut |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
my $get_version = sub { |
210
|
|
|
|
|
|
|
my $self = shift; |
211
|
|
|
|
|
|
|
$self->{'--version'} = 1; |
212
|
|
|
|
|
|
|
my $data = $get_data->($self, '--version'); |
213
|
|
|
|
|
|
|
unless ($data) { |
214
|
|
|
|
|
|
|
$self->error("Failed to find OSSP UUID version with ". |
215
|
|
|
|
|
|
|
"`$self->{uuid_config} --version`"); |
216
|
|
|
|
|
|
|
return; |
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
# Parse the verison out of the data. |
220
|
|
|
|
|
|
|
chomp $data; |
221
|
|
|
|
|
|
|
my ($name, $version, $date) = $data =~ /(\D+)\s+([\d.]+)\s+\(([^)]+)\)/; |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
# Check for and assign the name. |
224
|
|
|
|
|
|
|
$name |
225
|
|
|
|
|
|
|
? $self->{name} = $name |
226
|
|
|
|
|
|
|
: $self->error("Unable to parse name from string '$data'"); |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
# Parse the version number. |
229
|
|
|
|
|
|
|
if ($version) { |
230
|
|
|
|
|
|
|
my ($x, $y, $z) = $version =~ /(\d+)\.(\d+).(\d+)/; |
231
|
|
|
|
|
|
|
if (defined $x and defined $y and defined $z) { |
232
|
|
|
|
|
|
|
# Beta/devel/release candidates are treated as patch level "0" |
233
|
|
|
|
|
|
|
@{$self}{qw(version major minor patch)} = |
234
|
|
|
|
|
|
|
($version, $x, $y, $z); |
235
|
|
|
|
|
|
|
} elsif ($version =~ /(\d+)\.(\d+)/) { |
236
|
|
|
|
|
|
|
# New versions, such as "7.4", are treated as patch level "0" |
237
|
|
|
|
|
|
|
@{$self}{qw(version major minor patch)} = |
238
|
|
|
|
|
|
|
($version, $1, $2, 0); |
239
|
|
|
|
|
|
|
} else { |
240
|
|
|
|
|
|
|
$self->error("Failed to parse OSSP UUID version parts from " . |
241
|
|
|
|
|
|
|
"string '$version'"); |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
} else { |
244
|
|
|
|
|
|
|
$self->error("Unable to parse version from string '$data'"); |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
}; |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
sub name { |
249
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
250
|
1
|
50
|
|
|
|
6
|
return unless $self->{uuid_config}; |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
# Load data. |
253
|
1
|
50
|
|
|
|
7
|
$get_version->($self) unless $self->{'--version'}; |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
# Handle an unknown name. |
256
|
1
|
|
33
|
|
|
5
|
$self->{name} ||= $self->unknown( key => 'OSSP UUID name' ); |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
# Return the name. |
259
|
1
|
|
|
|
|
32
|
return $self->{name}; |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
############################################################################## |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=head3 version |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
my $version = $uuid->version; |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
Returns the OSSP UUID version number. App::Info::Lib::OSSPUUID parses the |
269
|
|
|
|
|
|
|
version number from the system call C<`uuid-config --version`>. |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
B |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=over 4 |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=item info |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
Executing `uuid-config --version` |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=item error |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
Failed to find OSSP UUID version with `uuid-config --version` |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
Unable to parse name from string |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
Unable to parse version from string |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
Failed to parse OSSP UUID version parts from string |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=item unknown |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
Enter a valid OSSP UUID version number |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=back |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=cut |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
sub version { |
298
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
299
|
1
|
50
|
|
|
|
5
|
return unless $self->{uuid_config}; |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
# Load data. |
302
|
1
|
50
|
|
|
|
7
|
$get_version->($self) unless $self->{'--version'}; |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
# Handle an unknown value. |
305
|
1
|
50
|
|
|
|
5
|
unless ($self->{version}) { |
306
|
|
|
|
|
|
|
# Create a validation code reference. |
307
|
|
|
|
|
|
|
my $chk_version = sub { |
308
|
|
|
|
|
|
|
# Try to get the version number parts. |
309
|
0
|
|
|
0
|
|
0
|
my ($x, $y, $z) = /^(\d+)\.(\d+).(\d+)$/; |
310
|
|
|
|
|
|
|
# Return false if we didn't get all three. |
311
|
0
|
0
|
0
|
|
|
0
|
return unless $x and defined $y and defined $z; |
|
|
|
0
|
|
|
|
|
312
|
|
|
|
|
|
|
# Save all three parts. |
313
|
0
|
|
|
|
|
0
|
@{$self}{qw(major minor patch)} = ($x, $y, $z); |
|
0
|
|
|
|
|
0
|
|
314
|
|
|
|
|
|
|
# Return true. |
315
|
0
|
|
|
|
|
0
|
return 1; |
316
|
0
|
|
|
|
|
0
|
}; |
317
|
0
|
|
|
|
|
0
|
$self->{version} = $self->unknown( |
318
|
|
|
|
|
|
|
key => 'OSSP UUID version number', |
319
|
|
|
|
|
|
|
callback => $chk_version |
320
|
|
|
|
|
|
|
); |
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
1
|
|
|
|
|
4
|
return $self->{version}; |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
############################################################################## |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=head3 major version |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
my $major_version = $uuid->major_version; |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
Returns the OSSP UUID library major version number. App::Info::Lib::OSSPUUID |
333
|
|
|
|
|
|
|
parses the major version number from the system call C<`uuid-config |
334
|
|
|
|
|
|
|
--version`>. For example, if C returns "1.3.0", then this method |
335
|
|
|
|
|
|
|
returns "1". |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
B |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
=over 4 |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
=item info |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
Executing `uuid-config --version` |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=item error |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
Failed to find OSSP UUID version with `uuid-config --version` |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
Unable to parse name from string |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
Unable to parse version from string |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
Failed to parse OSSP UUID version parts from string |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=item unknown |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
Enter a valid OSSP UUID major version number |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=back |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
=cut |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
# This code reference is used by major_version(), minor_version(), and |
364
|
|
|
|
|
|
|
# patch_version() to validate a version number entered by a user. |
365
|
|
|
|
|
|
|
my $is_int = sub { /^\d+$/ }; |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
sub major_version { |
368
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
369
|
1
|
50
|
|
|
|
5
|
return unless $self->{uuid_config}; |
370
|
|
|
|
|
|
|
# Load data. |
371
|
1
|
50
|
|
|
|
4
|
$get_version->($self) unless exists $self->{'--version'}; |
372
|
|
|
|
|
|
|
# Handle an unknown value. |
373
|
1
|
50
|
|
|
|
8
|
$self->{major} = $self->unknown( |
374
|
|
|
|
|
|
|
key => 'OSSP UUID major version number', |
375
|
|
|
|
|
|
|
callback => $is_int |
376
|
|
|
|
|
|
|
) unless $self->{major}; |
377
|
1
|
|
|
|
|
7
|
return $self->{major}; |
378
|
|
|
|
|
|
|
} |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
############################################################################## |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
=head3 minor version |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
my $minor_version = $uuid->minor_version; |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
Returns the OSSP UUID library minor version number. App::Info::Lib::OSSPUUID |
387
|
|
|
|
|
|
|
parses the minor version number from the system call C<`uuid-config |
388
|
|
|
|
|
|
|
--version`>. For example, if C returns "1.3.0", then this method |
389
|
|
|
|
|
|
|
returns "3". |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
B |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=over 4 |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=item info |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
Executing `uuid-config --version` |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
=item error |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
Failed to find OSSP UUID version with `uuid-config --version` |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
Unable to parse name from string |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
Unable to parse version from string |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
Failed to parse OSSP UUID version parts from string |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
=item unknown |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
Enter a valid OSSP UUID minor version number |
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
=back |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
=cut |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
sub minor_version { |
418
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
419
|
1
|
50
|
|
|
|
6
|
return unless $self->{uuid_config}; |
420
|
|
|
|
|
|
|
# Load data. |
421
|
1
|
50
|
|
|
|
4
|
$get_version->($self) unless exists $self->{'--version'}; |
422
|
|
|
|
|
|
|
# Handle an unknown value. |
423
|
1
|
50
|
|
|
|
5
|
$self->{minor} = $self->unknown( |
424
|
|
|
|
|
|
|
key => 'OSSP UUID minor version number', |
425
|
|
|
|
|
|
|
callback => $is_int |
426
|
|
|
|
|
|
|
) unless defined $self->{minor}; |
427
|
1
|
|
|
|
|
4
|
return $self->{minor}; |
428
|
|
|
|
|
|
|
} |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
############################################################################## |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
=head3 patch version |
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
my $patch_version = $uuid->patch_version; |
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
Returns the OSSP UUID library patch version number. App::Info::Lib::OSSPUUID |
437
|
|
|
|
|
|
|
parses the patch version number from the system call C<`uuid-config |
438
|
|
|
|
|
|
|
--version`>. For example, if C returns "1.3.0", then this method |
439
|
|
|
|
|
|
|
returns "0". |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
B |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
=over 4 |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
=item info |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
Executing `uuid-config --version` |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=item error |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
Failed to find OSSP UUID version with `uuid-config --version` |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
Unable to parse name from string |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
Unable to parse version from string |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
Failed to parse OSSP UUID version parts from string |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
=item unknown |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
Enter a valid OSSP UUID minor version number |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
=back |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
=cut |
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
sub patch_version { |
468
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
469
|
1
|
50
|
|
|
|
6
|
return unless $self->{uuid_config}; |
470
|
|
|
|
|
|
|
# Load data. |
471
|
1
|
50
|
|
|
|
5
|
$get_version->($self) unless exists $self->{'--version'}; |
472
|
|
|
|
|
|
|
# Handle an unknown value. |
473
|
1
|
50
|
|
|
|
5
|
$self->{patch} = $self->unknown( |
474
|
|
|
|
|
|
|
key => 'OSSP UUID patch version number', |
475
|
|
|
|
|
|
|
callback => $is_int |
476
|
|
|
|
|
|
|
) unless defined $self->{patch}; |
477
|
1
|
|
|
|
|
5
|
return $self->{patch}; |
478
|
|
|
|
|
|
|
} |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
############################################################################## |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
=head3 executable |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
my $exe = $uuid->executable; |
485
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
Returns the full path to the OSSP UUID executable, which is named F. |
487
|
|
|
|
|
|
|
This method does not use the executable names returned by |
488
|
|
|
|
|
|
|
C; those executable names are used to search for |
489
|
|
|
|
|
|
|
F only (in C). |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
When it called, C checks for an executable named F in the |
492
|
|
|
|
|
|
|
directory returned by C. |
493
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
Note that C is simply an alias for C. |
495
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
B |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
=over 4 |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
=item info |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
Looking for uuid executable |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
=item confirm |
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
Path to uuid executable? |
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
=item unknown |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
Path to uuid executable? |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
=back |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
=cut |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
sub executable { |
518
|
2
|
|
|
2
|
1
|
8
|
my $self = shift; |
519
|
2
|
|
|
|
|
12
|
my $key = 'uuid'; |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
# Find executable. |
522
|
2
|
|
|
|
|
34
|
$self->info("Looking for $key"); |
523
|
|
|
|
|
|
|
|
524
|
2
|
100
|
|
|
|
17
|
unless ($self->{$key}) { |
525
|
1
|
50
|
|
|
|
12
|
my $bin = $self->bin_dir or return; |
526
|
1
|
50
|
|
|
|
19
|
if (my $exe = $u->first_cat_exe([$self->search_uuid_names], $bin)) { |
527
|
|
|
|
|
|
|
# We found it. Confirm. |
528
|
|
|
|
|
|
|
$self->{$key} = $self->confirm( |
529
|
|
|
|
|
|
|
key => "path to $key", |
530
|
|
|
|
|
|
|
prompt => "Path to $key executable?", |
531
|
|
|
|
|
|
|
value => $exe, |
532
|
0
|
|
|
0
|
|
0
|
callback => sub { -x }, |
533
|
1
|
|
|
|
|
47
|
error => 'Not an executable' |
534
|
|
|
|
|
|
|
); |
535
|
|
|
|
|
|
|
} else { |
536
|
|
|
|
|
|
|
# Handle an unknown value. |
537
|
|
|
|
|
|
|
$self->{$key} = $self->unknown( |
538
|
|
|
|
|
|
|
key => "path to $key", |
539
|
|
|
|
|
|
|
prompt => "Path to $key executable?", |
540
|
0
|
|
|
0
|
|
0
|
callback => sub { -x }, |
541
|
0
|
|
|
|
|
0
|
error => 'Not an executable' |
542
|
|
|
|
|
|
|
); |
543
|
|
|
|
|
|
|
} |
544
|
|
|
|
|
|
|
} |
545
|
|
|
|
|
|
|
|
546
|
2
|
|
|
|
|
45
|
return $self->{$key}; |
547
|
|
|
|
|
|
|
}; |
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
*uuid = \&executable; |
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
############################################################################## |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
=head3 bin_dir |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
my $bin_dir = $uuid->bin_dir; |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
Returns the OSSP UUID binary directory path. App::Info::Lib::OSSPUUID gathers |
558
|
|
|
|
|
|
|
the path from the system call C<`uuid-config --bindir`>. |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
B |
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
=over 4 |
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
=item info |
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
Executing `uuid-config --bindir` |
567
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
=item error |
569
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
Cannot find bin directory |
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
=item unknown |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
Enter a valid OSSP UUID bin directory |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
=back |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
=cut |
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
# This code reference is used by bin_dir(), lib_dir(), and so_lib_dir() to |
581
|
|
|
|
|
|
|
# validate a directory entered by the user. |
582
|
|
|
|
|
|
|
my $is_dir = sub { -d }; |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
sub bin_dir { |
585
|
2
|
|
|
2
|
1
|
10
|
my $self = shift; |
586
|
2
|
50
|
|
|
|
18
|
return unless $self->{uuid_config}; |
587
|
2
|
100
|
|
|
|
15
|
unless (exists $self->{bin_dir} ) { |
588
|
1
|
50
|
|
|
|
4
|
if (my $dir = $get_data->($self, '--bindir')) { |
589
|
1
|
|
|
|
|
22
|
$self->{bin_dir} = $dir; |
590
|
|
|
|
|
|
|
} else { |
591
|
|
|
|
|
|
|
# Handle an unknown value. |
592
|
0
|
|
|
|
|
0
|
$self->error("Cannot find bin directory"); |
593
|
0
|
|
|
|
|
0
|
$self->{bin_dir} = $self->unknown( |
594
|
|
|
|
|
|
|
key => 'OSSP UUID bin dir', |
595
|
|
|
|
|
|
|
callback => $is_dir |
596
|
|
|
|
|
|
|
); |
597
|
|
|
|
|
|
|
} |
598
|
|
|
|
|
|
|
} |
599
|
|
|
|
|
|
|
|
600
|
2
|
|
|
|
|
37
|
return $self->{bin_dir}; |
601
|
|
|
|
|
|
|
} |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
############################################################################## |
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
=head3 inc_dir |
606
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
my $inc_dir = $uuid->inc_dir; |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
Returns the OSSP UUID include directory path. App::Info::Lib::OSSPUUID gathers |
610
|
|
|
|
|
|
|
the path from the system call C<`uuid-config --includedir`>. |
611
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
B |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
=over 4 |
615
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
=item info |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
Executing `uuid-config --includedir` |
619
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
=item error |
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
Cannot find include directory |
623
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
=item unknown |
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
Enter a valid OSSP UUID include directory |
627
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
=back |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
=cut |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
sub inc_dir { |
633
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
634
|
1
|
50
|
|
|
|
8
|
return unless $self->{uuid_config}; |
635
|
1
|
50
|
|
|
|
8
|
unless (exists $self->{inc_dir} ) { |
636
|
1
|
50
|
|
|
|
5
|
if (my $dir = $get_data->($self, '--includedir')) { |
637
|
1
|
|
|
|
|
21
|
$self->{inc_dir} = $dir; |
638
|
|
|
|
|
|
|
} else { |
639
|
|
|
|
|
|
|
# Handle an unknown value. |
640
|
0
|
|
|
|
|
0
|
$self->error("Cannot find include directory"); |
641
|
0
|
|
|
|
|
0
|
$self->{inc_dir} = $self->unknown( |
642
|
|
|
|
|
|
|
key => 'OSSP UUID include dir', |
643
|
|
|
|
|
|
|
callback => $is_dir |
644
|
|
|
|
|
|
|
); |
645
|
|
|
|
|
|
|
} |
646
|
|
|
|
|
|
|
} |
647
|
|
|
|
|
|
|
|
648
|
1
|
|
|
|
|
49
|
return $self->{inc_dir}; |
649
|
|
|
|
|
|
|
} |
650
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
############################################################################## |
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
=head3 lib_dir |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
my $lib_dir = $uuid->lib_dir; |
656
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
Returns the OSSP UUID library directory path. App::Info::Lib::OSSPUUID gathers |
658
|
|
|
|
|
|
|
the path from the system call C<`uuid-config --libdir`>. |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
B |
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
=over 4 |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
=item info |
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
Executing `uuid-config --libdir` |
667
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
=item error |
669
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
Cannot find library directory |
671
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
=item unknown |
673
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
Enter a valid OSSP UUID library directory |
675
|
|
|
|
|
|
|
|
676
|
|
|
|
|
|
|
=back |
677
|
|
|
|
|
|
|
|
678
|
|
|
|
|
|
|
=cut |
679
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
sub lib_dir { |
681
|
2
|
|
|
2
|
1
|
6
|
my $self = shift; |
682
|
2
|
50
|
|
|
|
11
|
return unless $self->{uuid_config}; |
683
|
2
|
100
|
|
|
|
10
|
unless (exists $self->{lib_dir} ) { |
684
|
1
|
50
|
|
|
|
5
|
if (my $dir = $get_data->($self, '--libdir')) { |
685
|
1
|
|
|
|
|
22
|
$self->{lib_dir} = $dir; |
686
|
|
|
|
|
|
|
} else { |
687
|
|
|
|
|
|
|
# Handle an unknown value. |
688
|
0
|
|
|
|
|
0
|
$self->error("Cannot find library directory"); |
689
|
0
|
|
|
|
|
0
|
$self->{lib_dir} = $self->unknown( |
690
|
|
|
|
|
|
|
key => 'OSSP UUID library dir', |
691
|
|
|
|
|
|
|
callback => $is_dir |
692
|
|
|
|
|
|
|
); |
693
|
|
|
|
|
|
|
} |
694
|
|
|
|
|
|
|
} |
695
|
|
|
|
|
|
|
|
696
|
2
|
|
|
|
|
197
|
return $self->{lib_dir}; |
697
|
|
|
|
|
|
|
} |
698
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
############################################################################## |
700
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
=head3 so_lib_dir |
702
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
my $so_lib_dir = $uuid->so_lib_dir; |
704
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
Returns the OSSP UUID shared object library directory path. This is actually |
706
|
|
|
|
|
|
|
just an alias for C. |
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
B |
709
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
=over 4 |
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
=item info |
713
|
|
|
|
|
|
|
|
714
|
|
|
|
|
|
|
Executing `uuid-config --libdir` |
715
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
=item error |
717
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
Cannot find library directory |
719
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
=item unknown |
721
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
Enter a valid OSSP UUID library directory |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
=back |
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
=cut |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
*so_lib_dir = \&lib_dir; |
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
############################################################################## |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
=head3 cflags |
733
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
my $configure = $uuid->cflags; |
735
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
Returns the C flags used when compiling the OSSP UUID library. |
737
|
|
|
|
|
|
|
App::Info::Lib::OSSPUUID gathers the configure data from the system call |
738
|
|
|
|
|
|
|
C<`uuid-config --cflags`>. |
739
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
B |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
=over 4 |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
=item info |
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
Executing `uuid-config --configure` |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
=item error |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
Cannot find configure information |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
=item unknown |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
Enter OSSP UUID configuration options |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
=back |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
=cut |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
sub cflags { |
761
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
762
|
1
|
50
|
|
|
|
93
|
return unless $self->{uuid_config}; |
763
|
1
|
50
|
|
|
|
9
|
unless (exists $self->{cflags} ) { |
764
|
1
|
50
|
|
|
|
9
|
if (my $conf = $get_data->($self, '--cflags')) { |
765
|
1
|
|
|
|
|
23
|
$self->{cflags} = $conf; |
766
|
|
|
|
|
|
|
} else { |
767
|
|
|
|
|
|
|
# Cflags can be empty, so just make sure it exists and is |
768
|
|
|
|
|
|
|
# defined. Don't prompt. |
769
|
0
|
|
|
|
|
0
|
$self->{cflags} = ''; |
770
|
|
|
|
|
|
|
} |
771
|
|
|
|
|
|
|
} |
772
|
|
|
|
|
|
|
|
773
|
1
|
|
|
|
|
48
|
return $self->{cflags}; |
774
|
|
|
|
|
|
|
} |
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
############################################################################## |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
=head3 ldflags |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
my $configure = $uuid->ldflags; |
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
Returns the LD flags used when compiling the OSSP UUID library. |
783
|
|
|
|
|
|
|
App::Info::Lib::OSSPUUID gathers the configure data from the system call |
784
|
|
|
|
|
|
|
C<`uuid-config --ldflags`>. |
785
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
B |
787
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
=over 4 |
789
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
=item info |
791
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
Executing `uuid-config --configure` |
793
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
=item error |
795
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
Cannot find configure information |
797
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
=item unknown |
799
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
Enter OSSP UUID configuration options |
801
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
=back |
803
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
=cut |
805
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
sub ldflags { |
807
|
1
|
|
|
1
|
1
|
9
|
my $self = shift; |
808
|
1
|
50
|
|
|
|
9
|
return unless $self->{uuid_config}; |
809
|
1
|
50
|
|
|
|
10
|
unless (exists $self->{ldflags} ) { |
810
|
1
|
50
|
|
|
|
11
|
if (my $conf = $get_data->($self, '--ldflags')) { |
811
|
1
|
|
|
|
|
19
|
$self->{ldflags} = $conf; |
812
|
|
|
|
|
|
|
} else { |
813
|
|
|
|
|
|
|
# Ldflags can be empty, so just make sure it exists and is |
814
|
|
|
|
|
|
|
# defined. Don't prompt. |
815
|
0
|
|
|
|
|
0
|
$self->{ldflags} = ''; |
816
|
|
|
|
|
|
|
} |
817
|
|
|
|
|
|
|
} |
818
|
|
|
|
|
|
|
|
819
|
1
|
|
|
|
|
43
|
return $self->{ldflags}; |
820
|
|
|
|
|
|
|
} |
821
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
############################################################################## |
823
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
=head3 perl_module |
825
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
my $bool = $uuid->perl_module; |
827
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
Return true if C is installed and can be loaded, and false if not. |
829
|
|
|
|
|
|
|
C must be able to be loaded by the currently running instance of |
830
|
|
|
|
|
|
|
the Perl interpreter. |
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
B |
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
=over 4 |
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
=item info |
837
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
Loading OSSP::uuid |
839
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
=back |
841
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
=cut |
843
|
|
|
|
|
|
|
|
844
|
|
|
|
|
|
|
sub perl_module { |
845
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
846
|
1
|
|
|
|
|
19
|
$self->info('Loading OSSP::uuuid'); |
847
|
1
|
|
33
|
|
|
21
|
$self->{perl_module} ||= do { |
848
|
1
|
|
|
1
|
|
14
|
eval 'use OSSP::uuid'; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
40
|
|
|
1
|
|
|
|
|
108
|
|
849
|
1
|
|
|
|
|
17
|
$INC{catfile qw(OSSP uuid.pm)}; |
850
|
|
|
|
|
|
|
}; |
851
|
1
|
|
|
|
|
20
|
return $self->{perl_module}; |
852
|
|
|
|
|
|
|
} |
853
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
############################################################################## |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
=head3 home_url |
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
my $home_url = $uuid->home_url; |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
Returns the OSSP UUID home page URL. |
861
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
=cut |
863
|
|
|
|
|
|
|
|
864
|
1
|
|
|
1
|
1
|
7
|
sub home_url { 'http://www.ossp.org/pkg/lib/uuid/' } |
865
|
|
|
|
|
|
|
|
866
|
|
|
|
|
|
|
############################################################################## |
867
|
|
|
|
|
|
|
|
868
|
|
|
|
|
|
|
=head3 download_url |
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
my $download_url = $uuid->download_url; |
871
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
Returns the OSSP UUID download URL. |
873
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
=cut |
875
|
|
|
|
|
|
|
|
876
|
1
|
|
|
1
|
1
|
7
|
sub download_url { 'http://www.ossp.org/pkg/lib/uuid/' } |
877
|
|
|
|
|
|
|
|
878
|
|
|
|
|
|
|
############################################################################## |
879
|
|
|
|
|
|
|
|
880
|
|
|
|
|
|
|
=head3 search_exe_names |
881
|
|
|
|
|
|
|
|
882
|
|
|
|
|
|
|
my @search_exe_names = $app->search_exe_names; |
883
|
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
Returns a list of possible names for F executable. By default, only |
885
|
|
|
|
|
|
|
F is returned (or F on Win32). |
886
|
|
|
|
|
|
|
|
887
|
|
|
|
|
|
|
Note that this method is not used to search for the OSSP UUID server |
888
|
|
|
|
|
|
|
executable, only F. |
889
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
=cut |
891
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
sub search_exe_names { |
893
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
894
|
2
|
|
|
|
|
5
|
my $exe = 'uuid-config'; |
895
|
2
|
|
|
|
|
3
|
$exe .= '.exe' if WIN32; |
896
|
2
|
|
|
|
|
17
|
return ($self->SUPER::search_exe_names, $exe); |
897
|
|
|
|
|
|
|
} |
898
|
|
|
|
|
|
|
|
899
|
|
|
|
|
|
|
############################################################################## |
900
|
|
|
|
|
|
|
|
901
|
|
|
|
|
|
|
=head3 search_bin_dirs |
902
|
|
|
|
|
|
|
|
903
|
|
|
|
|
|
|
my @search_bin_dirs = $app->search_bin_dirs; |
904
|
|
|
|
|
|
|
|
905
|
|
|
|
|
|
|
Returns a list of possible directories in which to search an executable. Used |
906
|
|
|
|
|
|
|
by the C constructor to find an executable to execute and collect |
907
|
|
|
|
|
|
|
application info. The found directory will also be returned by the C |
908
|
|
|
|
|
|
|
method. |
909
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
The list of directories by default consists of the path as defined by |
911
|
|
|
|
|
|
|
C<< File::Spec->path >>, as well as the following directories: |
912
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
=over 4 |
914
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
=item /usr/local/bin |
916
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
=item /usr/local/sbin |
918
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
=item /usr/bin |
920
|
|
|
|
|
|
|
|
921
|
|
|
|
|
|
|
=item /usr/sbin |
922
|
|
|
|
|
|
|
|
923
|
|
|
|
|
|
|
=item /bin |
924
|
|
|
|
|
|
|
|
925
|
|
|
|
|
|
|
=item C:\Program Files\uid\bin |
926
|
|
|
|
|
|
|
|
927
|
|
|
|
|
|
|
=back |
928
|
|
|
|
|
|
|
|
929
|
|
|
|
|
|
|
=cut |
930
|
|
|
|
|
|
|
|
931
|
|
|
|
|
|
|
sub search_bin_dirs { |
932
|
|
|
|
|
|
|
return shift->SUPER::search_bin_dirs, |
933
|
2
|
|
|
2
|
1
|
29
|
$u->path, |
934
|
|
|
|
|
|
|
qw(/usr/local/bin |
935
|
|
|
|
|
|
|
/usr/local/sbin |
936
|
|
|
|
|
|
|
/usr/bin |
937
|
|
|
|
|
|
|
/usr/sbin |
938
|
|
|
|
|
|
|
/bin), |
939
|
|
|
|
|
|
|
'C:\Program Files\uid\bin'; |
940
|
|
|
|
|
|
|
} |
941
|
|
|
|
|
|
|
|
942
|
|
|
|
|
|
|
############################################################################## |
943
|
|
|
|
|
|
|
|
944
|
|
|
|
|
|
|
=head2 Other Executable Methods |
945
|
|
|
|
|
|
|
|
946
|
|
|
|
|
|
|
These methods function just like the C method, except that they |
947
|
|
|
|
|
|
|
return different executables. OSSP UUID comes with a fair number of them; we |
948
|
|
|
|
|
|
|
provide these methods to provide a path to a subset of them. Each method, when |
949
|
|
|
|
|
|
|
called, checks for an executable in the directory returned by C. |
950
|
|
|
|
|
|
|
The name of the executable must be one of the names returned by the |
951
|
|
|
|
|
|
|
corresponding C method. |
952
|
|
|
|
|
|
|
|
953
|
|
|
|
|
|
|
The available executable methods are: |
954
|
|
|
|
|
|
|
|
955
|
|
|
|
|
|
|
=over |
956
|
|
|
|
|
|
|
|
957
|
|
|
|
|
|
|
=item uuid |
958
|
|
|
|
|
|
|
|
959
|
|
|
|
|
|
|
=item uuid_config |
960
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
=back |
962
|
|
|
|
|
|
|
|
963
|
|
|
|
|
|
|
And the corresponding search names methods are: |
964
|
|
|
|
|
|
|
|
965
|
|
|
|
|
|
|
=over |
966
|
|
|
|
|
|
|
|
967
|
|
|
|
|
|
|
=item search_postgres_names |
968
|
|
|
|
|
|
|
|
969
|
|
|
|
|
|
|
=item search_createdb_names |
970
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
=back |
972
|
|
|
|
|
|
|
|
973
|
|
|
|
|
|
|
B |
974
|
|
|
|
|
|
|
|
975
|
|
|
|
|
|
|
=over 4 |
976
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
=item info |
978
|
|
|
|
|
|
|
|
979
|
|
|
|
|
|
|
Looking for executable |
980
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
=item confirm |
982
|
|
|
|
|
|
|
|
983
|
|
|
|
|
|
|
Path to executable? |
984
|
|
|
|
|
|
|
|
985
|
|
|
|
|
|
|
=item unknown |
986
|
|
|
|
|
|
|
|
987
|
|
|
|
|
|
|
Path to executable? |
988
|
|
|
|
|
|
|
|
989
|
|
|
|
|
|
|
=back |
990
|
|
|
|
|
|
|
|
991
|
|
|
|
|
|
|
=cut |
992
|
|
|
|
|
|
|
|
993
|
1
|
|
|
1
|
0
|
4
|
sub search_uuid_names { @{ shift->{search_uuid_names} } } |
|
1
|
|
|
|
|
43
|
|
994
|
|
|
|
|
|
|
|
995
|
|
|
|
|
|
|
1; |
996
|
|
|
|
|
|
|
__END__ |