line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
########################################### |
2
|
|
|
|
|
|
|
package Perldoc::Search; |
3
|
|
|
|
|
|
|
########################################### |
4
|
1
|
|
|
1
|
|
57739
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1002
|
use Pod::Simple::TextContent; |
|
1
|
|
|
|
|
32754
|
|
|
1
|
|
|
|
|
34
|
|
10
|
1
|
|
|
1
|
|
470
|
use SWISH::API::Common; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Config; |
12
|
|
|
|
|
|
|
use Cwd; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
########################################### |
15
|
|
|
|
|
|
|
sub new { |
16
|
|
|
|
|
|
|
########################################### |
17
|
|
|
|
|
|
|
my($class, %options) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $self = { |
20
|
|
|
|
|
|
|
dirs => [$Config{installsitearch}, |
21
|
|
|
|
|
|
|
$Config{installsitelib}, |
22
|
|
|
|
|
|
|
$Config{installarchlib}, |
23
|
|
|
|
|
|
|
$Config{installprivlib}, |
24
|
|
|
|
|
|
|
], |
25
|
|
|
|
|
|
|
swish_options => { |
26
|
|
|
|
|
|
|
swish_adm_dir => "$ENV{HOME}/.perldig", |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
%options, |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# If the perl lib dir is symlinked, this |
32
|
|
|
|
|
|
|
# will figure out the real paths |
33
|
|
|
|
|
|
|
for(@{$self->{dirs}}) { |
34
|
|
|
|
|
|
|
my $cwd = cwd(); |
35
|
|
|
|
|
|
|
chdir $_ or die "Cannot cwd to $_"; |
36
|
|
|
|
|
|
|
$_ = File::Spec->rel2abs("."); |
37
|
|
|
|
|
|
|
chdir $cwd; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$self->{swish} = SWISH::API::Common->new( |
41
|
|
|
|
|
|
|
%{$self->{swish_options}} |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
bless $self, $class; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
########################################### |
48
|
|
|
|
|
|
|
sub relative { |
49
|
|
|
|
|
|
|
########################################### |
50
|
|
|
|
|
|
|
my($self, $path) = @_; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
$path =~ s|^$_/|| for @{$self->{dirs}}; |
53
|
|
|
|
|
|
|
return $path; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
########################################### |
57
|
|
|
|
|
|
|
sub update { |
58
|
|
|
|
|
|
|
########################################### |
59
|
|
|
|
|
|
|
my($self) = @_; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Index all files in a directory and its subdirectories |
62
|
|
|
|
|
|
|
$self->{swish}->index(@{$self->{dirs}}); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
########################################### |
66
|
|
|
|
|
|
|
sub search { |
67
|
|
|
|
|
|
|
########################################### |
68
|
|
|
|
|
|
|
my($self, @terms) = @_; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
return $self->{swish}->search(@terms); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
__END__ |