line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: MMagic.pm 877 2002-10-29 11:16:05Z richardc $ |
2
|
|
|
|
|
|
|
package File::Find::Rule::MMagic; |
3
|
1
|
|
|
1
|
|
21651
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
921
|
use File::Find::Rule; |
|
1
|
|
|
|
|
9388
|
|
|
1
|
|
|
|
|
9
|
|
6
|
1
|
|
|
1
|
|
79
|
use base qw( File::Find::Rule ); |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
135
|
|
7
|
1
|
|
|
1
|
|
4
|
use vars qw( $VERSION @EXPORT ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
64
|
|
8
|
|
|
|
|
|
|
@EXPORT = @File::Find::Rule::EXPORT; |
9
|
|
|
|
|
|
|
$VERSION = '0.02'; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
1338
|
use File::MMagic; |
|
1
|
|
|
|
|
20875
|
|
|
1
|
|
|
|
|
59
|
|
12
|
1
|
|
|
1
|
|
12
|
use Text::Glob qw(glob_to_regex); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
191
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub File::Find::Rule::magic { |
15
|
1
|
|
|
1
|
0
|
54
|
my $self = shift()->_force_object; |
16
|
1
|
50
|
|
|
|
9
|
my @patterns = map { ref $_ ? $_ : glob_to_regex $_ } @_; |
|
1
|
|
|
|
|
10
|
|
17
|
1
|
|
|
|
|
151
|
my $mm = new File::MMagic; |
18
|
|
|
|
|
|
|
$self->exec( sub { |
19
|
3
|
|
|
3
|
|
899
|
my $type = $mm->checktype_filename($_); |
20
|
3
|
100
|
|
|
|
29092
|
for (@patterns) { return 1 if $type =~ m/$_/ } |
|
3
|
|
|
|
|
73
|
|
21
|
2
|
|
|
|
|
72
|
return; |
22
|
1
|
|
|
|
|
613
|
} ); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
__END__ |