line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Ack::Filter::Match; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
214650
|
use strict; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
116
|
|
4
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
111
|
|
5
|
4
|
|
|
4
|
|
22
|
use parent 'App::Ack::Filter'; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
21
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
1030
|
use App::Ack::Filter::MatchGroup (); |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
960
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
App::Ack::Filter::Match |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Implements filtering files by their filename (regular expression). |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new { |
20
|
2
|
|
|
2
|
0
|
8
|
my ( $class, $re ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
15
|
$re =~ s{^/|/$}{}g; # XXX validate? |
23
|
2
|
|
|
|
|
26
|
$re = qr/$re/i; |
24
|
|
|
|
|
|
|
|
25
|
2
|
|
|
|
|
13
|
return bless { |
26
|
|
|
|
|
|
|
regex => $re, |
27
|
|
|
|
|
|
|
groupname => 'MatchGroup', |
28
|
|
|
|
|
|
|
}, $class; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub create_group { |
32
|
0
|
|
|
0
|
0
|
0
|
return App::Ack::Filter::MatchGroup->new; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub filter { |
36
|
170
|
|
|
170
|
1
|
550
|
my ( $self, $file ) = @_; |
37
|
|
|
|
|
|
|
|
38
|
170
|
|
|
|
|
266
|
return $file->basename =~ /$self->{regex}/; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub inspect { |
42
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
return ref($self) . ' - ' . $self->{regex}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub to_string { |
48
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return "Filename matches $self->{regex}"; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
BEGIN { |
54
|
4
|
|
|
4
|
|
25
|
App::Ack::Filter->register_filter(match => __PACKAGE__); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |