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
|
2
|
|
|
2
|
|
6314
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
59
|
|
14
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
68
|
|
15
|
2
|
|
|
2
|
|
12
|
use parent 'App::Ack::Filter'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
15
|
|
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
129
|
use App::Ack::Filter (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
43
|
|
18
|
2
|
|
|
2
|
|
957
|
use App::Ack::Filter::ExtensionGroup (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
559
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
0
|
|
|
0
|
0
|
|
my ( $class, @extensions ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my $exts = join('|', map { "\Q$_\E"} @extensions); |
|
0
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $re = qr/[.](?:$exts)$/i; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
return bless { |
27
|
|
|
|
|
|
|
extensions => \@extensions, |
28
|
|
|
|
|
|
|
regex => $re, |
29
|
|
|
|
|
|
|
groupname => 'ExtensionGroup', |
30
|
|
|
|
|
|
|
}, $class; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub create_group { |
34
|
0
|
|
|
0
|
0
|
|
return App::Ack::Filter::ExtensionGroup->new(); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub filter { |
38
|
0
|
|
|
0
|
1
|
|
my ( $self, $file ) = @_; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
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
|
2
|
|
|
2
|
|
16
|
App::Ack::Filter->register_filter(ext => __PACKAGE__); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |