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
|
2
|
|
|
2
|
|
1852
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
59
|
|
15
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
55
|
|
16
|
2
|
|
|
2
|
|
10
|
use parent 'App::Ack::Filter'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
9
|
|
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; |