line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Search::Tools; |
2
|
41
|
|
|
41
|
|
57502
|
use 5.008_003; |
|
41
|
|
|
|
|
89
|
|
3
|
41
|
|
|
41
|
|
122
|
use strict; |
|
41
|
|
|
|
|
43
|
|
|
41
|
|
|
|
|
701
|
|
4
|
41
|
|
|
41
|
|
130
|
use warnings::register; |
|
41
|
|
|
|
|
42
|
|
|
41
|
|
|
|
|
3938
|
|
5
|
41
|
|
|
41
|
|
142
|
use Carp; |
|
41
|
|
|
|
|
74
|
|
|
41
|
|
|
|
|
2016
|
|
6
|
41
|
|
|
41
|
|
135
|
use Scalar::Util qw( openhandle ); |
|
41
|
|
|
|
|
82
|
|
|
41
|
|
|
|
|
2388
|
|
7
|
41
|
|
|
41
|
|
166
|
use File::Basename; |
|
41
|
|
|
|
|
37
|
|
|
41
|
|
|
|
|
2734
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '1.004'; |
10
|
|
|
|
|
|
|
|
11
|
41
|
|
|
41
|
|
182
|
use XSLoader; |
|
41
|
|
|
|
|
57
|
|
|
41
|
|
|
|
|
15289
|
|
12
|
|
|
|
|
|
|
XSLoader::load( 'Search::Tools', $VERSION ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $XS_DEBUG = 0; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub parser { |
17
|
19
|
|
|
19
|
1
|
7675
|
my $class = shift; |
18
|
19
|
|
|
|
|
6334
|
require Search::Tools::QueryParser; |
19
|
19
|
|
|
|
|
246
|
return Search::Tools::QueryParser->new(@_); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub regexp { |
23
|
0
|
|
|
0
|
1
|
0
|
my $class = shift; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
0
|
croak("as of version 0.24 you should use parser() instead of regexp()"); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub hiliter { |
29
|
11
|
|
|
11
|
1
|
1882
|
my $class = shift; |
30
|
11
|
|
|
|
|
3160
|
require Search::Tools::HiLiter; |
31
|
11
|
|
|
|
|
122
|
return Search::Tools::HiLiter->new(@_); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub snipper { |
35
|
6
|
|
|
6
|
1
|
1152
|
my $class = shift; |
36
|
6
|
|
|
|
|
2111
|
require Search::Tools::Snipper; |
37
|
6
|
|
|
|
|
79
|
return Search::Tools::Snipper->new(@_); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub transliterate { |
41
|
0
|
|
|
0
|
1
|
0
|
my $class = shift; |
42
|
0
|
|
|
|
|
0
|
require Search::Tools::Transliterate; |
43
|
0
|
|
|
|
|
0
|
return Search::Tools::Transliterate->new->convert(@_); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub spellcheck { |
47
|
0
|
|
|
0
|
1
|
0
|
my $class = shift; |
48
|
0
|
|
|
|
|
0
|
require Search::Tools::SpellCheck; |
49
|
0
|
|
|
|
|
0
|
return Search::Tools::SpellCheck->new(@_); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub slurp { |
53
|
16
|
|
|
16
|
1
|
6134
|
my ( $self, $file ) = @_; |
54
|
16
|
|
|
|
|
26
|
my ( $buf, $fh ); |
55
|
16
|
|
|
|
|
1105
|
my ( $name, $path, $suffix ) = fileparse( $file, qr/\.[^.]*/ ); |
56
|
16
|
|
|
|
|
65
|
$suffix = lc($suffix); |
57
|
16
|
50
|
|
|
|
85
|
if ( $suffix eq '.gz' ) { |
|
|
50
|
|
|
|
|
|
58
|
0
|
|
|
|
|
0
|
require IO::Uncompress::Gunzip; |
59
|
0
|
|
|
|
|
0
|
$fh = IO::Uncompress::Gunzip->new($file); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
elsif ( $suffix eq '.bz2' ) { |
62
|
0
|
|
|
|
|
0
|
require IO::Uncompress::Bunzip2; |
63
|
0
|
0
|
|
|
|
0
|
$fh = IO::Uncompress::Bunzip2->new($file) |
64
|
|
|
|
|
|
|
or die "bunzip2 failed: $IO::Uncompress::Bunzip2::Bunzip2Error\n"; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
else { |
68
|
16
|
|
|
|
|
7563
|
require IO::File; |
69
|
16
|
|
33
|
|
|
91156
|
$fh = openhandle($file) || IO::File->new( $file, '<' ); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
16
|
50
|
|
|
|
1348
|
die "Failed to open $file: $!" unless $fh; |
73
|
|
|
|
|
|
|
|
74
|
16
|
|
|
|
|
409
|
while ( my $ln = $fh->getline ) { |
75
|
1918
|
|
|
|
|
52251
|
$buf .= $ln; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
16
|
|
|
|
|
722
|
return $buf; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |