line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: MMagic.pm 877 2002-10-29 11:16:05Z richardc $ |
2
|
|
|
|
|
|
|
package File::Find::Object::Rule::MMagic; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
25964
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
82
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
24
|
use 5.008; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
31
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1085
|
use File::Find::Object::Rule; |
|
1
|
|
|
|
|
42290
|
|
|
1
|
|
|
|
|
15
|
|
10
|
1
|
|
|
1
|
|
101
|
use parent qw( File::Find::Object::Rule ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
11
|
1
|
|
|
1
|
|
87
|
use vars qw( $VERSION @EXPORT ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
106
|
|
12
|
|
|
|
|
|
|
@EXPORT = @File::Find::Object::Rule::EXPORT; |
13
|
|
|
|
|
|
|
$VERSION = '0.0.4'; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
1663
|
use File::MMagic; |
|
1
|
|
|
|
|
60077
|
|
|
1
|
|
|
|
|
49
|
|
16
|
1
|
|
|
1
|
|
13
|
use Text::Glob qw(glob_to_regex); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
240
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub File::Find::Object::Rule::magic { |
19
|
1
|
|
|
1
|
0
|
60
|
my $self = shift()->_force_object; |
20
|
1
|
50
|
|
|
|
7
|
my @patterns = map { ref $_ ? $_ : glob_to_regex $_ } @_; |
|
1
|
|
|
|
|
10
|
|
21
|
1
|
|
|
|
|
161
|
my $mm = new File::MMagic; |
22
|
|
|
|
|
|
|
$self->exec( sub { |
23
|
7
|
|
|
7
|
|
3506
|
my (undef, undef, $path) = @_; |
24
|
7
|
|
|
|
|
31
|
my $type = $mm->checktype_filename($path); |
25
|
7
|
|
|
|
|
53533
|
for my $pat (@patterns) |
26
|
|
|
|
|
|
|
{ |
27
|
7
|
100
|
|
|
|
95
|
return 1 if $type =~ m/$pat/ |
28
|
|
|
|
|
|
|
} |
29
|
6
|
|
|
|
|
226
|
return; |
30
|
1
|
|
|
|
|
595
|
} ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
__END__ |