line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Find::Match::Util; |
2
|
|
|
|
|
|
|
require 5.008; |
3
|
1
|
|
|
1
|
|
892
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
5
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
76
|
|
6
|
1
|
|
|
1
|
|
6
|
use base 'Exporter'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
97
|
|
7
|
1
|
|
|
1
|
|
6
|
use File::Basename (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
397
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
10
|
|
|
|
|
|
|
our @EXPORT = qw( ); |
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw( filename ext wildcard ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub filename ($) { |
14
|
2
|
100
|
|
2
|
1
|
1329
|
my $basename = shift or croak 'Usage: filename($basename)'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
return sub { |
17
|
7
|
100
|
|
7
|
|
1135
|
croak "filename() predicate passed undef filename!" if not defined $_[0]; |
18
|
5
|
|
|
|
|
172
|
File::Basename::basename($_[0]) eq $basename; |
19
|
1
|
|
|
|
|
8
|
}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub ext ($) { |
23
|
3
|
100
|
|
3
|
1
|
1015
|
my $ext = shift or croak 'Usage: ext($extension)'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
return sub { |
26
|
3
|
100
|
|
3
|
|
929
|
my $s = shift or croak "predicate ext($ext) called with bad arguments"; |
27
|
2
|
|
|
|
|
13
|
substr($s, rindex($s, '.') + 1) eq $ext; |
28
|
1
|
|
|
|
|
7
|
}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub wildcard ($) { |
32
|
1
|
50
|
|
1
|
1
|
397
|
my $pat = shift or croak 'Usage: wildcard($pattern)'; |
33
|
1
|
|
|
|
|
4
|
my $re = quotemeta $pat; |
34
|
1
|
|
|
|
|
6
|
$re =~ s/\\\*/(.+)/g; |
35
|
1
|
|
|
|
|
25
|
my $regex = qr/$re/; |
36
|
|
|
|
|
|
|
return sub { |
37
|
1
|
|
|
1
|
|
392
|
$_[0] =~ $regex; |
38
|
1
|
|
|
|
|
7
|
}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
__END__ |