line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Ack::Filter::Extension; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
App::Ack::Filter::Extension |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Implements filters based on extensions. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
4
|
|
221566
|
use strict; |
|
4
|
|
|
|
|
17
|
|
|
4
|
|
|
|
|
120
|
|
14
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
22
|
|
|
4
|
|
|
|
|
115
|
|
15
|
4
|
|
|
4
|
|
21
|
use parent 'App::Ack::Filter'; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
28
|
|
16
|
|
|
|
|
|
|
|
17
|
4
|
|
|
4
|
|
185
|
use App::Ack::Filter (); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
67
|
|
18
|
4
|
|
|
4
|
|
1719
|
use App::Ack::Filter::ExtensionGroup (); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
1092
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
2
|
|
|
2
|
0
|
9
|
my ( $class, @extensions ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
6
|
my $exts = join('|', map { "\Q$_\E"} @extensions); |
|
8
|
|
|
|
|
24
|
|
24
|
2
|
|
|
|
|
80
|
my $re = qr/[.](?:$exts)$/i; |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
19
|
return bless { |
27
|
|
|
|
|
|
|
extensions => \@extensions, |
28
|
|
|
|
|
|
|
regex => $re, |
29
|
|
|
|
|
|
|
groupname => 'ExtensionGroup', |
30
|
|
|
|
|
|
|
}, $class; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub create_group { |
34
|
0
|
|
|
0
|
0
|
0
|
return App::Ack::Filter::ExtensionGroup->new(); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub filter { |
38
|
170
|
|
|
170
|
1
|
493
|
my ( $self, $file ) = @_; |
39
|
|
|
|
|
|
|
|
40
|
170
|
|
|
|
|
282
|
return $file->name =~ /$self->{regex}/; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub inspect { |
44
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
return ref($self) . ' - ' . $self->{regex}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub to_string { |
50
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
return join( ' ', map { ".$_" } @{$self->{extensions}} ); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
BEGIN { |
56
|
4
|
|
|
4
|
|
43
|
App::Ack::Filter->register_filter(ext => __PACKAGE__); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |