line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Search::Tools::RegEx; |
2
|
26
|
|
|
26
|
|
139
|
use Moo; |
|
26
|
|
|
|
|
42
|
|
|
26
|
|
|
|
|
135
|
|
3
|
|
|
|
|
|
|
extends 'Search::Tools::Object'; |
4
|
26
|
|
|
26
|
|
6477
|
use Carp; |
|
26
|
|
|
|
|
53
|
|
|
26
|
|
|
|
|
2346
|
|
5
|
|
|
|
|
|
|
use overload |
6
|
0
|
|
|
0
|
|
0
|
'""' => sub { $_[0]->term; }, |
7
|
2
|
|
|
2
|
|
172
|
'bool' => sub {1}, |
8
|
26
|
|
|
26
|
|
173
|
fallback => 1; |
|
26
|
|
|
|
|
56
|
|
|
26
|
|
|
|
|
205
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#use Data::Dump qw( dump ); |
11
|
|
|
|
|
|
|
|
12
|
26
|
|
|
26
|
|
2229
|
use namespace::autoclean; |
|
26
|
|
|
|
|
10610
|
|
|
26
|
|
|
|
|
156
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '1.006'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my @ro_attrs = qw( |
17
|
|
|
|
|
|
|
plain |
18
|
|
|
|
|
|
|
html |
19
|
|
|
|
|
|
|
term |
20
|
|
|
|
|
|
|
term_re |
21
|
|
|
|
|
|
|
is_phrase |
22
|
|
|
|
|
|
|
phrase_terms |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
for my $attr (@ro_attrs) { |
26
|
|
|
|
|
|
|
has $attr => ( is => 'ro' ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Search::Tools::RegEx - regular expressions for terms |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SYNOPSIS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $regex = $query->regex_for('foo'); |
36
|
|
|
|
|
|
|
like( 'foo', $regex->plain, "matches plain (no markup)"); |
37
|
|
|
|
|
|
|
like( 'foo', $regex->html, "matches html (with markup)"); |
38
|
|
|
|
|
|
|
ok( ! $regex->is_phrase, "foo is not a phrase"); |
39
|
|
|
|
|
|
|
is( 'foo', $regex->term, "foo is the term"); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 DESCRIPTION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 METHODS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 plain |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 html |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 term |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 term_re |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 is_phrase |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 phrase_terms |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
If B is true, B will contain an ARRAY ref |
59
|
|
|
|
|
|
|
of Search::Tools::RegEx objects, each one representing a term |
60
|
|
|
|
|
|
|
in the phrase. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |