line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Info::RDBMS::SQLite; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
App::Info::RDBMS::SQLite - Information about SQLite |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use App::Info::RDBMS::SQLite; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $sqlite = App::Info::RDBMS::SQLite->new; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
if ($sqlite->installed) { |
14
|
|
|
|
|
|
|
print "App name: ", $sqlite->name, "\n"; |
15
|
|
|
|
|
|
|
print "Version: ", $sqlite->version, "\n"; |
16
|
|
|
|
|
|
|
print "Bin dir: ", $sqlite->bin_dir, "\n"; |
17
|
|
|
|
|
|
|
} else { |
18
|
|
|
|
|
|
|
print "SQLite is not installed. :-(\n"; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
App::Info::RDBMS::SQLite supplies information about the SQLite application |
24
|
|
|
|
|
|
|
installed on the local system. It implements all of the methods defined by |
25
|
|
|
|
|
|
|
App::Info::RDBMS. 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 SQLite) construct a |
28
|
|
|
|
|
|
|
new App::Info::RDBMS::SQLite object to aggregate new meta data. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Some of the methods trigger the same events. This is due to cross-calling of |
31
|
|
|
|
|
|
|
shared subroutines. However, any one event should be triggered no more than |
32
|
|
|
|
|
|
|
once. For example, although the info event "Executing `pg_config --version`" |
33
|
|
|
|
|
|
|
is documented for the methods C, C, C, |
34
|
|
|
|
|
|
|
C, and C, rest assured that it will only be |
35
|
|
|
|
|
|
|
triggered once, by whichever of those four methods is called first. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
############################################################################## |
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
2
|
|
40509
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
80
|
|
42
|
2
|
|
|
2
|
|
839
|
use App::Info::RDBMS; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
47
|
|
43
|
2
|
|
|
2
|
|
1505
|
use App::Info::Util; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
69
|
|
44
|
2
|
|
|
2
|
|
14
|
use vars qw(@ISA $VERSION); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
132
|
|
45
|
|
|
|
|
|
|
@ISA = qw(App::Info::RDBMS); |
46
|
|
|
|
|
|
|
$VERSION = '0.57'; |
47
|
2
|
|
|
2
|
|
10
|
use constant WIN32 => $^O eq 'MSWin32'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
5264
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $u = App::Info::Util->new; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 INTERFACE |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 Constructor |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head3 new |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $sqlite = App::Info::RDBMS::SQLite->new(@params); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Returns an App::Info::RDBMS::SQLite object. See L for a |
60
|
|
|
|
|
|
|
complete description of argument parameters. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
When it called, C searches the directories returned by |
63
|
|
|
|
|
|
|
F for an executable with a name returned by |
64
|
|
|
|
|
|
|
C. If found, it will be called by the object methods below |
65
|
|
|
|
|
|
|
to gather the data necessary for each. If it cannot be found, then C |
66
|
|
|
|
|
|
|
will attempt to load L or |
67
|
|
|
|
|
|
|
L. These DBI drivers have SQLite embedded in them |
68
|
|
|
|
|
|
|
but do not install the application. If these fail, then SQLite is assumed not |
69
|
|
|
|
|
|
|
to be installed, and each of the object methods will return C. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
B |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=over 4 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item info |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Looking for SQLite. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item confirm |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Path to SQLite executable? |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item unknown |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Path to SQLite executable? |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=back |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub new { |
92
|
|
|
|
|
|
|
# Construct the object. |
93
|
2
|
|
|
2
|
1
|
888
|
my $self = shift->SUPER::new(@_); |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# Find pg_config. |
96
|
2
|
|
|
|
|
20
|
$self->info("Looking for SQLite"); |
97
|
|
|
|
|
|
|
|
98
|
2
|
|
|
|
|
37
|
my @exes = $self->search_exe_names; |
99
|
2
|
100
|
|
|
|
9
|
if (my $cfg = $u->first_cat_exe(\@exes, $self->search_bin_dirs)) { |
100
|
|
|
|
|
|
|
# We found it. Confirm. |
101
|
|
|
|
|
|
|
$self->{executable} = $self->confirm( |
102
|
|
|
|
|
|
|
key => 'path to sqlite', |
103
|
|
|
|
|
|
|
prompt => "Path to SQLite executable?", |
104
|
|
|
|
|
|
|
value => $cfg, |
105
|
0
|
|
|
0
|
|
0
|
callback => sub { -x }, |
106
|
1
|
|
|
|
|
89
|
error => 'Not an executable' |
107
|
|
|
|
|
|
|
); |
108
|
|
|
|
|
|
|
} else { |
109
|
1
|
|
|
|
|
4
|
$self->info("Looking for DBD::SQLite"); |
110
|
|
|
|
|
|
|
# Try using DBD::SQLite, which includes SQLite. |
111
|
1
|
|
|
|
|
4
|
for my $dbd ('SQLite', 'SQLite2') { |
112
|
2
|
|
|
1
|
|
139
|
eval "use DBD::$dbd"; |
|
1
|
|
|
1
|
|
471
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
411
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
113
|
2
|
50
|
|
|
|
9
|
next if $@; |
114
|
|
|
|
|
|
|
# Looks like DBD::SQLite is installed. Set up a temp database |
115
|
|
|
|
|
|
|
# handle so we can get information from it. |
116
|
0
|
|
|
|
|
0
|
require DBI; |
117
|
0
|
|
|
|
|
0
|
$self->{dbfile} = $u->catfile($u->tmpdir, 'tmpdb'); |
118
|
0
|
|
|
|
|
0
|
$self->{dbh} = DBI->connect("dbi:$dbd:dbname=$self->{dbfile}","",""); |
119
|
|
|
|
|
|
|
# I don't think there's any way to really confirm, so just return. |
120
|
0
|
|
|
|
|
0
|
return $self; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# Handle an unknown value. |
124
|
|
|
|
|
|
|
$self->{executable} = $self->unknown( |
125
|
|
|
|
|
|
|
key => 'path to sqlite', |
126
|
|
|
|
|
|
|
prompt => "Path to SQLite executable?", |
127
|
0
|
|
|
0
|
|
0
|
callback => sub { -x }, |
128
|
1
|
|
|
|
|
12
|
error => 'Not an executable' |
129
|
|
|
|
|
|
|
); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
2
|
|
|
|
|
21
|
return $self; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub DESTROY { |
136
|
2
|
|
|
2
|
|
4263
|
my $self = shift; |
137
|
2
|
50
|
|
|
|
25
|
$self->{dbh}->disconnect if $self->{dbh}; |
138
|
2
|
50
|
|
|
|
301
|
unlink $self->{dbfile} if $self->{dbfile}; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
############################################################################## |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 Class Method |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head3 key_name |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
my $key_name = App::Info::RDBMS::SQLite->key_name; |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Returns the unique key name that describes this class. The value returned is |
150
|
|
|
|
|
|
|
the string "SQLite". |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=cut |
153
|
|
|
|
|
|
|
|
154
|
2
|
|
|
2
|
1
|
10
|
sub key_name { 'SQLite' } |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
############################################################################## |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head2 Object Methods |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head3 installed |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
print "SQLite is ", ($sqlite->installed ? '' : 'not '), "installed.\n"; |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Returns true if SQLite is installed, and false if it is not. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
App::Info::RDBMS::SQLite determines whether SQLite is installed based on the |
167
|
|
|
|
|
|
|
presence or absence of the F or F application on the file |
168
|
|
|
|
|
|
|
system as found when C constructed the object. If SQLite does not |
169
|
|
|
|
|
|
|
appear to be installed, then all of the other object methods will return empty |
170
|
|
|
|
|
|
|
values. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |
173
|
|
|
|
|
|
|
|
174
|
7
|
100
|
66
|
7
|
1
|
71
|
sub installed { return $_[0]->{executable} || $_[0]->{dbh} ? 1 : undef } |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
############################################################################## |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head3 name |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
my $name = $sqlite->name; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Returns the name of the application. App::Info::RDBMS::SQLite simply returns |
183
|
|
|
|
|
|
|
the value returned by C if SQLite is installed, and C if |
184
|
|
|
|
|
|
|
it is not installed. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=cut |
187
|
|
|
|
|
|
|
|
188
|
1
|
50
|
|
1
|
1
|
5
|
sub name { $_[0]->installed ? $_[0]->key_name : undef } |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
# This code reference is used by version(), major_version(), minor_version(), |
191
|
|
|
|
|
|
|
# and patch_version() to aggregate the data they need. |
192
|
|
|
|
|
|
|
my $get_version = sub { |
193
|
|
|
|
|
|
|
my $self = shift; |
194
|
|
|
|
|
|
|
$self->{'--version'} = 1; |
195
|
|
|
|
|
|
|
my $version; |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
if ($self->{executable}) { |
198
|
|
|
|
|
|
|
# Get the version number from the executable. |
199
|
|
|
|
|
|
|
$self->info(qq{Executing `"$self->{executable}" -version`}); |
200
|
|
|
|
|
|
|
$version = `"$self->{executable}" -version`; |
201
|
|
|
|
|
|
|
unless ($version) { |
202
|
|
|
|
|
|
|
$self->error("Failed to find SQLite version with ". |
203
|
|
|
|
|
|
|
"`$self->{executable} -version`"); |
204
|
|
|
|
|
|
|
return; |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
chomp $version; |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
} elsif ($self->{dbh}) { |
209
|
|
|
|
|
|
|
# Get the version number from the database handle. |
210
|
|
|
|
|
|
|
$self->info('Grabbing version from DBD::SQLite'); |
211
|
|
|
|
|
|
|
$version = $self->{dbh}->{sqlite_version}; |
212
|
|
|
|
|
|
|
unless ($version) { |
213
|
|
|
|
|
|
|
$self->error("Failed to retrieve SQLite version from DBD::SQLite"); |
214
|
|
|
|
|
|
|
return; |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
} else { |
218
|
|
|
|
|
|
|
# No dice. |
219
|
|
|
|
|
|
|
return; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
# Parse the version number. |
223
|
|
|
|
|
|
|
my ($x, $y, $z) = $version =~ /(\d+)\.(\d+).(\d+)/; |
224
|
|
|
|
|
|
|
if (defined $x and defined $y and defined $z) { |
225
|
|
|
|
|
|
|
# Beta/devel/release candidates are treated as patch level "0" |
226
|
|
|
|
|
|
|
@{$self}{qw(version major minor patch)} = |
227
|
|
|
|
|
|
|
($version, $x, $y, $z); |
228
|
|
|
|
|
|
|
} elsif ($version =~ /(\d+)\.(\d+)/) { |
229
|
|
|
|
|
|
|
# New versions, such as "3.0", are treated as patch level "0" |
230
|
|
|
|
|
|
|
@{$self}{qw(version major minor patch)} = |
231
|
|
|
|
|
|
|
($version, $1, $2, 0); |
232
|
|
|
|
|
|
|
} else { |
233
|
|
|
|
|
|
|
$self->error("Failed to parse SQLite version parts from " . |
234
|
|
|
|
|
|
|
"string '$version'"); |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
}; |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
############################################################################## |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head3 version |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
my $version = $sqlite->version; |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
Returns the SQLite version number. App::Info::RDBMS::SQLite parses the version |
245
|
|
|
|
|
|
|
number from the system call C<`sqlite -version`> or retrieves it from |
246
|
|
|
|
|
|
|
DBD::SQLite. |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
B |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=over 4 |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=item info |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
Executing `sqlite -version` |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=item error |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
Failed to find SQLite version with `sqlite -version` |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
Failed to retrieve SQLite version from DBD::SQLite |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
Unable to parse name from string |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
Unable to parse version from string |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
Failed to parse SQLite version parts from string |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=item unknown |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
Enter a valid SQLite version number |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=back |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=cut |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
sub version { |
277
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
278
|
1
|
50
|
|
|
|
4
|
return unless $self->installed; |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
# Get data. |
281
|
1
|
50
|
|
|
|
8
|
$get_version->($self) unless $self->{'--version'}; |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
# Handle an unknown value. |
284
|
1
|
50
|
|
|
|
15
|
unless ($self->{version}) { |
285
|
|
|
|
|
|
|
# Create a validation code reference. |
286
|
|
|
|
|
|
|
my $chk_version = sub { |
287
|
|
|
|
|
|
|
# Try to get the version number parts. |
288
|
0
|
|
|
0
|
|
0
|
my ($x, $y, $z) = /^(\d+)\.(\d+).(\d+)$/; |
289
|
|
|
|
|
|
|
# Return false if we didn't get all three. |
290
|
0
|
0
|
0
|
|
|
0
|
return unless $x and defined $y and defined $z; |
|
|
|
0
|
|
|
|
|
291
|
|
|
|
|
|
|
# Save all three parts. |
292
|
0
|
|
|
|
|
0
|
@{$self}{qw(major minor patch)} = ($x, $y, $z); |
|
0
|
|
|
|
|
0
|
|
293
|
|
|
|
|
|
|
# Return true. |
294
|
0
|
|
|
|
|
0
|
return 1; |
295
|
0
|
|
|
|
|
0
|
}; |
296
|
0
|
|
|
|
|
0
|
$self->{version} = $self->unknown( key => 'sqlite version number', |
297
|
|
|
|
|
|
|
callback => $chk_version); |
298
|
|
|
|
|
|
|
} |
299
|
1
|
|
|
|
|
39
|
return $self->{version}; |
300
|
|
|
|
|
|
|
} |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
############################################################################## |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
=head3 major version |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
my $major_version = $sqlite->major_version; |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
Returns the SQLite major version number. App::Info::RDBMS::SQLite parses the |
309
|
|
|
|
|
|
|
version number from the system call C<`sqlite -version`> or retrieves it from |
310
|
|
|
|
|
|
|
DBD::SQLite. For example, if C returns "3.0.8", then this method |
311
|
|
|
|
|
|
|
returns "3". |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
B |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=over 4 |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
=item info |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
Executing `sqlite -version` |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=item error |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
Failed to find SQLite version with `sqlite -version` |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
Failed to retrieve SQLite version from DBD::SQLite |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
Unable to parse name from string |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
Unable to parse version from string |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
Failed to parse SQLite version parts from string |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
=item unknown |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
Enter a valid SQLite version number |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
=back |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
=cut |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
# This code reference is used by major_version(), minor_version(), and |
342
|
|
|
|
|
|
|
# patch_version() to validate a version number entered by a user. |
343
|
|
|
|
|
|
|
my $is_int = sub { /^\d+$/ }; |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
sub major_version { |
346
|
1
|
|
|
1
|
1
|
93
|
my $self = shift; |
347
|
1
|
50
|
|
|
|
9
|
return unless $self->installed; |
348
|
|
|
|
|
|
|
# Load data. |
349
|
1
|
50
|
|
|
|
13
|
$get_version->($self) unless exists $self->{'--version'}; |
350
|
|
|
|
|
|
|
# Handle an unknown value. |
351
|
1
|
50
|
|
|
|
8
|
$self->{major} = $self->unknown( key => 'sqlite major version number', |
352
|
|
|
|
|
|
|
callback => $is_int) |
353
|
|
|
|
|
|
|
unless $self->{major}; |
354
|
1
|
|
|
|
|
6
|
return $self->{major}; |
355
|
|
|
|
|
|
|
} |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
############################################################################## |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=head3 minor version |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
my $minor_version = $sqlite->minor_version; |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
Returns the SQLite minor version number. App::Info::RDBMS::SQLite parses the |
364
|
|
|
|
|
|
|
version number from the system call C<`sqlite -version`> or retrieves it from |
365
|
|
|
|
|
|
|
DBD::SQLite. For example, if C returns "3.0.8", then this method |
366
|
|
|
|
|
|
|
returns "0". |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
B |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
=over 4 |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
=item info |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
Executing `sqlite -version` |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
=item error |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
Failed to find SQLite version with `sqlite -version` |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
Failed to retrieve SQLite version from DBD::SQLite |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
Unable to parse name from string |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
Unable to parse version from string |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
Failed to parse SQLite version parts from string |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
=item unknown |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
Enter a valid SQLite version number |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
=back |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
=cut |
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
sub minor_version { |
397
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
398
|
1
|
50
|
|
|
|
4
|
return unless $self->installed; |
399
|
|
|
|
|
|
|
# Load data. |
400
|
1
|
50
|
|
|
|
7
|
$get_version->($self) unless exists $self->{'--version'}; |
401
|
|
|
|
|
|
|
# Handle an unknown value. |
402
|
1
|
50
|
|
|
|
5
|
$self->{minor} = $self->unknown( key => 'sqlite minor version number', |
403
|
|
|
|
|
|
|
callback => $is_int) |
404
|
|
|
|
|
|
|
unless defined $self->{minor}; |
405
|
1
|
|
|
|
|
6
|
return $self->{minor}; |
406
|
|
|
|
|
|
|
} |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
############################################################################## |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
=head3 patch version |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
my $patch_version = $sqlite->patch_version; |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
Returns the SQLite patch version number. App::Info::RDBMS::SQLite parses the |
415
|
|
|
|
|
|
|
version number from the system call C<`sqlite -version`> or retrieves it from |
416
|
|
|
|
|
|
|
DBD::SQLite. For example, if C returns "3.0.8", then this method |
417
|
|
|
|
|
|
|
returns "8". |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
B |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
=over 4 |
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
=item info |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
Executing `sqlite -version` |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
=item error |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
Failed to find SQLite version with `sqlite -version` |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
Failed to retrieve SQLite version from DBD::SQLite |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
Unable to parse name from string |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
Unable to parse version from string |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
Failed to parse SQLite version parts from string |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=item unknown |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
Enter a valid SQLite version number |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
=back |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
=cut |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
sub patch_version { |
448
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
449
|
1
|
50
|
|
|
|
4
|
return unless $self->installed; |
450
|
|
|
|
|
|
|
# Load data. |
451
|
1
|
50
|
|
|
|
5
|
$get_version->($self) unless exists $self->{'--version'}; |
452
|
|
|
|
|
|
|
# Handle an unknown value. |
453
|
1
|
50
|
|
|
|
4
|
$self->{patch} = $self->unknown( key => 'sqlite patch version number', |
454
|
|
|
|
|
|
|
callback => $is_int) |
455
|
|
|
|
|
|
|
unless defined $self->{patch}; |
456
|
1
|
|
|
|
|
7
|
return $self->{patch}; |
457
|
|
|
|
|
|
|
} |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
############################################################################## |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
=head3 executable |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
my $executable = $sqlite->executable; |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
Returns the path to the SQLite executable, usually F or F, |
466
|
|
|
|
|
|
|
which will be defined by one of the names returned byC. |
467
|
|
|
|
|
|
|
The executable is searched for in C, so there are no events for this |
468
|
|
|
|
|
|
|
method. |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
=cut |
471
|
|
|
|
|
|
|
|
472
|
1
|
|
|
1
|
1
|
8
|
sub executable { shift->{executable} } |
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
############################################################################## |
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
=head3 bin_dir |
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
my $bin_dir = $sqlite->bin_dir; |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
Returns the SQLite binary directory path. App::Info::RDBMS::SQLite simply |
481
|
|
|
|
|
|
|
retrieves it as the directory part of the path to the SQLite executable. |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
=cut |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
sub bin_dir { |
486
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
487
|
1
|
50
|
|
|
|
6
|
return unless $self->{executable}; |
488
|
1
|
50
|
|
|
|
5
|
unless (exists $self->{bin_dir} ) { |
489
|
1
|
|
|
|
|
19
|
my @parts = $u->splitpath($self->{executable}); |
490
|
1
|
50
|
|
|
|
40
|
$self->{bin_dir} = $u->catdir( |
491
|
|
|
|
|
|
|
($parts[0] eq '' ? () : $parts[0]), |
492
|
|
|
|
|
|
|
$u->splitdir($parts[1]) |
493
|
|
|
|
|
|
|
); |
494
|
|
|
|
|
|
|
} |
495
|
1
|
|
|
|
|
123
|
return $self->{bin_dir}; |
496
|
|
|
|
|
|
|
} |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
############################################################################## |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
=head3 lib_dir |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
my $lib_dir = $expat->lib_dir; |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
Returns the directory path in which an SQLite library was found. The directory |
505
|
|
|
|
|
|
|
path will be one of the values returned by C, where a file |
506
|
|
|
|
|
|
|
with a name as returned by C was found. No search is |
507
|
|
|
|
|
|
|
performed if SQLite is not installed or if only DBD::SQLite is installed. |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
B |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
=over 4 |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
=item info |
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
Searching for shared object library directory |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
=item error |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
Cannot find shared object library directory |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
=item unknown |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
Enter a valid Expat shared object library directory |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
=back |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
=cut |
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
my $lib_dir = sub { |
530
|
|
|
|
|
|
|
my ($self, $key, $label) = (shift, shift, shift); |
531
|
|
|
|
|
|
|
return unless $self->{executable}; |
532
|
|
|
|
|
|
|
$self->info("Searching for $label directory"); |
533
|
|
|
|
|
|
|
my $dir; |
534
|
|
|
|
|
|
|
unless ($dir = $u->first_cat_dir(\@_, $self->search_lib_dirs)) { |
535
|
|
|
|
|
|
|
$self->error("Cannot find $label directory"); |
536
|
|
|
|
|
|
|
$dir = $self->unknown( |
537
|
|
|
|
|
|
|
key => "sqlite $key dir", |
538
|
|
|
|
|
|
|
callback => sub { $u->first_cat_dir(\@_, $_) }, |
539
|
|
|
|
|
|
|
error => "No $label found in directory " |
540
|
|
|
|
|
|
|
); |
541
|
|
|
|
|
|
|
} |
542
|
|
|
|
|
|
|
return $dir; |
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
}; |
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
sub lib_dir { |
547
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
548
|
1
|
50
|
|
|
|
9
|
return unless $self->{executable}; |
549
|
1
|
50
|
|
|
|
9
|
$self->{lib_dir} = $self->$lib_dir('lib', 'library', $self->search_lib_names) |
550
|
|
|
|
|
|
|
unless exists $self->{lib_dir}; |
551
|
1
|
|
|
|
|
13
|
return $self->{lib_dir}; |
552
|
|
|
|
|
|
|
} |
553
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
############################################################################## |
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
=head3 so_lib_dir |
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
my $so_lib_dir = $expat->so_lib_dir; |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
Returns the directory path in which an SQLite shared object library was |
561
|
|
|
|
|
|
|
found. The directory path will be one of the values returned by |
562
|
|
|
|
|
|
|
C, where a file with a name as returned by |
563
|
|
|
|
|
|
|
C was found. No search is performed if SQLite is not |
564
|
|
|
|
|
|
|
installed or if only DBD::SQLite is installed. |
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
B |
567
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
=over 4 |
569
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
=item info |
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
Searching for shared object library directory |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
=item error |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
Cannot find shared object library directory |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
=item unknown |
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
Enter a valid Expat shared object library directory |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
=back |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
=cut |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
sub so_lib_dir { |
587
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
588
|
1
|
50
|
|
|
|
6
|
return unless $self->{executable}; |
589
|
1
|
50
|
|
|
|
10
|
$self->{so_lib_dir} = $self->$lib_dir('so', 'shared object library', |
590
|
|
|
|
|
|
|
$self->search_so_lib_names) |
591
|
|
|
|
|
|
|
unless exists $self->{so_lib_dir}; |
592
|
1
|
|
|
|
|
8
|
return $self->{so_lib_dir}; |
593
|
|
|
|
|
|
|
} |
594
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
############################################################################## |
596
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
=head3 inc_dir |
598
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
my $inc_dir = $sqlite->inc_dir; |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
Returns the directory path in which an SQLite include file was found. The |
602
|
|
|
|
|
|
|
directory path will be one of the values returned by C, |
603
|
|
|
|
|
|
|
where a file with a name as returned by C was found. No |
604
|
|
|
|
|
|
|
search is performed if SQLite is not installed or if only DBD::SQLite is |
605
|
|
|
|
|
|
|
installed. |
606
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
B |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
=over 4 |
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
=item info |
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
Searching for include directory |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
=item error |
616
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
Cannot find include directory |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
=item unknown |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
Enter a valid SQLite include directory |
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
=back |
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
=cut |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
sub inc_dir { |
628
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
629
|
1
|
50
|
|
|
|
7
|
return unless $self->{executable}; |
630
|
1
|
50
|
|
|
|
5
|
unless (exists $self->{inc_dir}) { |
631
|
1
|
|
|
|
|
5
|
$self->info("Searching for include directory"); |
632
|
|
|
|
|
|
|
# Should there be more paths than this? |
633
|
1
|
|
|
|
|
8
|
my @incs = $self->search_inc_names; |
634
|
|
|
|
|
|
|
|
635
|
1
|
50
|
|
|
|
7
|
if (my $dir = $u->first_cat_dir(\@incs, $self->search_inc_dirs)) { |
636
|
1
|
|
|
|
|
10
|
$self->{inc_dir} = $dir; |
637
|
|
|
|
|
|
|
} else { |
638
|
0
|
|
|
|
|
0
|
$self->error("Cannot find include directory"); |
639
|
|
|
|
|
|
|
$self->{inc_dir} = $self->unknown( |
640
|
|
|
|
|
|
|
key => 'sqlite inc dir', |
641
|
0
|
|
|
0
|
|
0
|
callback => sub { $u->first_cat_dir(\@incs, $_) }, |
642
|
0
|
|
|
|
|
0
|
error => "File 'sqlite.h' not found in directory" |
643
|
|
|
|
|
|
|
); |
644
|
|
|
|
|
|
|
} |
645
|
|
|
|
|
|
|
} |
646
|
1
|
|
|
|
|
8
|
return $self->{inc_dir}; |
647
|
|
|
|
|
|
|
} |
648
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
############################################################################## |
650
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
=head3 home_url |
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
my $home_url = $pg->home_url; |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
Returns the PostgreSQL home page URL. |
656
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
=cut |
658
|
|
|
|
|
|
|
|
659
|
1
|
|
|
1
|
1
|
9
|
sub home_url { "http://www.sqlite.org/" } |
660
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
############################################################################## |
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
=head3 download_url |
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
my $download_url = $pg->download_url; |
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
Returns the PostgreSQL download URL. |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
=cut |
670
|
|
|
|
|
|
|
|
671
|
1
|
|
|
1
|
1
|
5
|
sub download_url { "http://www.sqlite.org/download.html" } |
672
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
############################################################################## |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
=head3 search_exe_names |
676
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
my @search_exe_names = $sqlite->search_exe_names; |
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
Returns a list of possible names for the SQLite executable. The names are |
680
|
|
|
|
|
|
|
F and F by default (F and F on |
681
|
|
|
|
|
|
|
Win32). |
682
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
=cut |
684
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
sub search_exe_names { |
686
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
687
|
2
|
|
|
|
|
8
|
my @exes = qw(sqlite3 sqlite); |
688
|
2
|
|
|
|
|
3
|
if (WIN32) { $_ .= ".exe" for @exes } |
689
|
2
|
|
|
|
|
21
|
return ($self->SUPER::search_exe_names, @exes); |
690
|
|
|
|
|
|
|
} |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
############################################################################## |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
=head3 search_bin_dirs |
695
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
my @search_bin_dirs = $sqlite->search_bin_dirs; |
697
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
Returns a list of possible directories in which to search an executable. Used |
699
|
|
|
|
|
|
|
by the C constructor to find an executable to execute and collect |
700
|
|
|
|
|
|
|
application info. The found directory will also be returned by the C |
701
|
|
|
|
|
|
|
method. |
702
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
=cut |
704
|
|
|
|
|
|
|
|
705
|
2
|
|
|
2
|
1
|
17
|
sub search_bin_dirs { (shift->SUPER::search_bin_dirs, $u->path) } |
706
|
|
|
|
|
|
|
|
707
|
|
|
|
|
|
|
############################################################################## |
708
|
|
|
|
|
|
|
|
709
|
|
|
|
|
|
|
=head3 search_lib_names |
710
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
my @seach_lib_names = $self->search_lib_nams |
712
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
Returns a list of possible names for library files. Used by C to |
714
|
|
|
|
|
|
|
search for library files. By default, the list is: |
715
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
=over |
717
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
=item libsqlite3.a |
719
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
=item libsqlite3.la |
721
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
=item libsqlite3.so |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
=item libsqlite3.so.0 |
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
=item libsqlite3.so.0.0.1 |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
=item libsqlite3.dylib |
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
=item libsqlite3.0.dylib |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
=item libsqlite3.0.0.1.dylib |
733
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
=item libsqlite.a |
735
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
=item libsqlite.la |
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
=item libsqlite.so |
739
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
=item libsqlite.so.0 |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
=item libsqlite.so.0.0.1 |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
=item libsqlite.dylib |
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
=item libsqlite.0.dylib |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
=item libsqlite.0.0.1.dylib |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
=back |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
=cut |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
sub search_lib_names { |
755
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
756
|
1
|
|
|
|
|
74
|
(my $exe = $u->splitpath($self->{executable})) =~ s/\.[^.]+$//; |
757
|
8
|
|
|
|
|
23
|
return $self->SUPER::search_lib_names, |
758
|
1
|
|
|
|
|
34
|
map { "lib$exe.$_"} qw(a la so so.0 so.0.0.1 dylib 0.dylib 0.0.1.dylib); |
759
|
|
|
|
|
|
|
} |
760
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
############################################################################## |
762
|
|
|
|
|
|
|
|
763
|
|
|
|
|
|
|
=head3 search_so_lib_names |
764
|
|
|
|
|
|
|
|
765
|
|
|
|
|
|
|
my @seach_so_lib_names = $self->search_so_lib_nams |
766
|
|
|
|
|
|
|
|
767
|
|
|
|
|
|
|
Returns a list of possible names for shared object library files. Used by |
768
|
|
|
|
|
|
|
C to search for library files. By default, the list is: |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
=over |
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
=item libsqlite3.so |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
=item libsqlite3.so.0 |
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
=item libsqlite3.so.0.0.1 |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
=item libsqlite3.dylib |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
=item libsqlite3.0.dylib |
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
=item libsqlite3.0.0.1.dylib |
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
=item libsqlite.so |
785
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
=item libsqlite.so.0 |
787
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
=item libsqlite.so.0.0.1 |
789
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
=item libsqlite.dylib |
791
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
=item libsqlite.0.dylib |
793
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
=item libsqlite.0.0.1.dylib |
795
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
=back |
797
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
=cut |
799
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
sub search_so_lib_names { |
801
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
802
|
1
|
|
|
|
|
17
|
(my $exe = $u->splitpath($self->{executable})) =~ s/\.[^.]+$//; |
803
|
6
|
|
|
|
|
22
|
return $self->SUPER::search_so_lib_names, |
804
|
1
|
|
|
|
|
20
|
map { "lib$exe.$_"} |
805
|
|
|
|
|
|
|
qw(so so.0 so.0.0.1 dylib 0.dylib 0.0.1.dylib); |
806
|
|
|
|
|
|
|
} |
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
############################################################################## |
809
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
=head3 search_lib_dirs |
811
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
my @search_lib_dirs = $sqlite->search_lib_dirs; |
813
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
Returns a list of possible directories in which to search for libraries. By |
815
|
|
|
|
|
|
|
default, it returns all of the paths in the C and C |
816
|
|
|
|
|
|
|
attributes defined by the Perl L module -- plus F (in |
817
|
|
|
|
|
|
|
support of all you Fink users out there). |
818
|
|
|
|
|
|
|
|
819
|
|
|
|
|
|
|
=cut |
820
|
|
|
|
|
|
|
|
821
|
2
|
|
|
2
|
1
|
19
|
sub search_lib_dirs { shift->SUPER::search_lib_dirs, $u->lib_dirs, '/sw/lib' } |
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
############################################################################## |
824
|
|
|
|
|
|
|
|
825
|
|
|
|
|
|
|
=head3 search_inc_names |
826
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
my @search_inc_names = $sqlite->search_inc_names; |
828
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
Returns a list of include file names to search for. Used by C to |
830
|
|
|
|
|
|
|
search for an include file. By default, the names are F and |
831
|
|
|
|
|
|
|
F. |
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
=cut |
834
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
sub search_inc_names { |
836
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
837
|
1
|
|
|
|
|
15
|
(my $exe = $u->splitpath($self->{executable})) =~ s/\.[^.]+$//; |
838
|
1
|
|
|
|
|
11
|
return $self->SUPER::search_inc_names, "$exe.h"; |
839
|
|
|
|
|
|
|
} |
840
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
############################################################################## |
842
|
|
|
|
|
|
|
|
843
|
|
|
|
|
|
|
=head3 search_inc_dirs |
844
|
|
|
|
|
|
|
|
845
|
|
|
|
|
|
|
my @search_inc_dirs = $sqlite->search_inc_dirs; |
846
|
|
|
|
|
|
|
|
847
|
|
|
|
|
|
|
Returns a list of possible directories in which to search for include files. |
848
|
|
|
|
|
|
|
Used by C to search for an include file. By default, the |
849
|
|
|
|
|
|
|
directories are: |
850
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
=over 4 |
852
|
|
|
|
|
|
|
|
853
|
|
|
|
|
|
|
=item /usr/local/include |
854
|
|
|
|
|
|
|
|
855
|
|
|
|
|
|
|
=item /usr/include |
856
|
|
|
|
|
|
|
|
857
|
|
|
|
|
|
|
=item /sw/include |
858
|
|
|
|
|
|
|
|
859
|
|
|
|
|
|
|
=back |
860
|
|
|
|
|
|
|
|
861
|
|
|
|
|
|
|
=cut |
862
|
|
|
|
|
|
|
|
863
|
|
|
|
|
|
|
sub search_inc_dirs { |
864
|
|
|
|
|
|
|
shift->SUPER::search_inc_dirs, |
865
|
1
|
|
|
1
|
1
|
10
|
qw(/usr/local/include |
866
|
|
|
|
|
|
|
/usr/include |
867
|
|
|
|
|
|
|
/sw/include); |
868
|
|
|
|
|
|
|
} |
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
1; |
871
|
|
|
|
|
|
|
__END__ |