blib/lib/File/MMagic/XS.pm

filter: Statementstmt 100% 34 / 34 Branchbran 75.0% 6 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 88.8% 48 / 54 CC 7 SCAR 9.9
CC
7
Cov
91%
import
4.0
BEGIN
3.0
new
2.1
CRAP 2.7
↑ Summary blib/lib/File/MMagic/benchmark.pl »
1 package File::MMagic::XS;
2 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use XSLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 7 our $VERSION;
7 7 our $MAGIC_FILE;
8  
9 BEGIN
10 7 ▶{
Subroutine BEGIN: called CC=3 SCAR=11.0
11 7 $VERSION = '0.09008';
12 7 XSLoader::load(__PACKAGE__, $VERSION);
13  
14 7 require File::Spec;
15 7 foreach my $path (map { File::Spec->catfile($_, qw(File MMagic magic)) } @INC) {
16 14 ▶ if (-f $path) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $path) 7 7 14
17 7 $MAGIC_FILE = $path;
18 7 last;
19 }
20 }
21 }
22  
23 sub import
24 7 ▶{
Subroutine import: called CC=4 SCAR=14.0
25 7 my $class = shift;
26  
27 7 ▶ for(my $idx = 0; $idx < @_; $idx++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($idx < @_) 2 5 7
28 2 ▶ if ($_[$idx] eq ':compat') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[$idx] eq ":compat") 2 0 2
29 2 *checktype_filename = \&get_mime;
30 2 *checktype_filehandle = \&fhmagic;
31 2 *checktype_contents = \&bufmagic;
32 2 *addMagicEntry = \&add_magic;
33  
34 2 ▶ splice(@_, $idx, 1) and last;
Branch: 1 branch
BranchTrueFalseTotal
splice @_, $idx, 1 and last 2 0 2
35 }
36 }
37  
38 7 $class->SUPER::import(@_);
39 }
40  
41 8 ▶sub new {
Subroutine new: called CC=2 SCAR=7.2
Pod documented
42 8 my ($class, $magic_file) = @_;
43 8 ▶ $magic_file ||= $MAGIC_FILE;
Condition33%1/3
$magic_file ||= $File::MMagic::XS::MAGIC_FILE
l!l&&r!l&&!r
080
MC/DC0%0/2
$magic_file ||= $File::MMagic::XS::MAGIC_FILE
$magic_file $File::MMagic::XS::MAGIC_FILE
Truth table33%1/3
A ||= B
A= $magic_fileB= $File::MMagic::XS::MAGIC_FILE
ABresult
1X1
011
000
44  
45 8 my $self = $class->_create();
46 8 $self->parse_magic_file( $magic_file );
47 8 return $self;
48 }
49  
50 7 1;
51  
52 __END__
↑ Summary blib/lib/File/MMagic/benchmark.pl »