line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Ack::Filter::MatchGroup; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
App::Ack::Filter::MatchGroup |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
The App::Ack::Filter::MatchGroup class optimizes multiple ::Match calls |
10
|
|
|
|
|
|
|
into one container. See App::Ack::Filter::IsGroup for details. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
4
|
|
1756
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
108
|
|
15
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
100
|
|
16
|
4
|
|
|
4
|
|
20
|
use parent 'App::Ack::Filter'; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
19
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
0
|
|
|
0
|
0
|
|
my ( $class ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
return bless { |
22
|
|
|
|
|
|
|
matches => [], |
23
|
|
|
|
|
|
|
big_re => undef, |
24
|
|
|
|
|
|
|
}, $class; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub add { |
28
|
0
|
|
|
0
|
0
|
|
my ( $self, $filter ) = @_; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
push @{ $self->{matches} }, $filter->{regex}; |
|
0
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $re = join('|', map { "(?:$_)" } @{ $self->{matches} }); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$self->{big_re} = qr/$re/; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub filter { |
39
|
0
|
|
|
0
|
1
|
|
my ( $self, $file ) = @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
return $file->basename =~ /$self->{big_re}/; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# This class has no inspect() or to_string() method. |
45
|
|
|
|
|
|
|
# It will just use the default one unless someone writes something useful. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |