lib/AudioFile/Info/Build.pm

filter: Statementstmt 38.2% 13 / 34 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 27.6% 18 / 65 CC 12 SCAR 47.6
CC
12
Cov
24%
ACTION_install
156.0
BEGIN
1.0
BEGIN
1.0
CRAP 117.2
↑ Summary blib/lib/AudioFile/Info/MP4/Info.pm »
1 package AudioFile::Info::Build;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use base 'Module::Build';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use YAML qw(LoadFile DumpFile);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 0 ▶sub ACTION_install {
Subroutine ACTION_install: not called CC=12 SCAR=50.5
Pod documented
11 0 my $self = shift;
12  
13 0 $self->SUPER::ACTION_install(@_);
14  
15 0 require AudioFile::Info;
16  
17 0 ▶ die "Can't find the installation of AudioFile::Info\n" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
18  
19 0 my $pkg = $self->notes('package');
20  
21 0 my $path = $INC{'AudioFile/Info.pm'};
22  
23 0 $path =~ s/Info.pm$/plugins.yaml/;
24  
25 0 my $config;
26  
27 0 ▶ if (-f $path) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $path) 0 0 0
28 0 $config = LoadFile($path);
29 }
30  
31 0 $config->{$pkg} = $self->notes('config');
32  
33 # calculate "usefulness" score
34  
35 0 foreach my $ext (qw(mp4 m4a m4p 3gp)) {
36 0 my $tmp;
37 0 for (qw(read write)) {
38 0 ▶ $tmp += 50 if $config->{$pkg}{"${_}_mp4"};
Branch: 1 branch
BranchTrueFalseTotal
if $config->{$pkg}{"${_}_mp4"} 0 0 0
39 }
40  
41  
42 # prefer non-perl implementations
43 0 ▶ unless ($config->{$pkg}{pure_perl}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($config->{$pkg}{"pure_perl"}) 0 0 0
44 0 ▶ $tmp += 10 if $tmp;
Branch: 1 branch
BranchTrueFalseTotal
if $tmp 0 0 0
45 }
46  
47 # if no default set and this plugin has a score, or if this plugin
48 # score higher than the existing default, then set default
49 0 ▶ if (! exists $config->{default}{$ext} and $tmp
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $config->{"default"}{$ext} and $tmp or $tmp and $tmp >= $config->{"default"}{$ext}{"score"}) 0 0 0
Condition0%0/9
not exists $config->{"default"}{$ext} and $tmp or $tmp and $tmp >= $config->{"default"}{$ext}{"score"}
l!l&&r!l&&!r
000
not exists $config->{"default"}{$ext} and $tmp
!ll&&!rl&&r
000
$tmp and $tmp >= $config->{"default"}{$ext}{"score"}
!ll&&!rl&&r
000
MC/DC0%0/4
not exists $config->{"default"}{$ext} and $tmp or $tmp and $tmp >= $config->{"default"}{$ext}{"score"}
not exists $config->{"default"}{$ext} $tmp $tmp $tmp >= $config->{"default"}{$ext}{"score"}
Truth table0%0/7
not(A) and B or C and D
A= not exists $config->{"default"}{$ext}B= $tmpC= $tmpD= $tmp >= $config->{"default"}{$ext}{"score"}
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
50 or $tmp and $tmp >= $config->{default}{$ext}{score}) {
51 0 $config->{default}{$ext} = { name => $pkg, score => $tmp };
52 0 warn "AudioFile::Info - Default $ext handler is now $pkg\n";
53 }
54 }
55 0 DumpFile($path, $config);
56 }
57  
58 2 1;
59  
60 =head1 NAME
61  
62 AudioFile::Info::Build - Build utilities for AudioFile::Info.
63  
64 =head1 DESCRIPTION
65  
66 This is a module which is used as part of the build system for
67 AudioFile::Info plugins.
68  
69 See L<AudioFile::Info> for more details.
70  
71 =head1 METHODS
72  
73 =head2 ACTION_install
74  
75 Overrides the ACTION_install method from Module::Build.
76  
77 =head1 AUTHOR
78  
79 Dave Cross, E<lt>dave@dave.org.ukE<gt>
80  
81 =head1 COPYRIGHT AND LICENSE
82  
83 Copyright 2003 by Dave Cross
84  
85 This library is free software; you can redistribute it and/or modify
86 it under the same terms as Perl itself.
87  
88 =cut
89  
90  
↑ Summary blib/lib/AudioFile/Info/MP4/Info.pm »