Tag/Auto.pm

filter: Statementstmt 100% 38 / 38 Branchbran 70.0% 7 / 10 Conditioncond 60.0% 3 / 5 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 89.0% 57 / 64 CC 8 SCAR 16.9
CC
8
Cov
91%
new
8.1
BEGIN
1.0
BEGIN
1.0
CRAP 5.4
« Tag.pm ↑ Summary Tag/Option.pm »
1 package Music::Tag::Auto;
2 2 ▶use strict; use warnings; use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 2 our $VERSION = '.4101';
5 2 ▶use base qw(Music::Tag::Generic);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # Copyright © 2006 Edward Allen III. Some rights reserved.
8  
9 #
10 # You may distribute under the terms of either the GNU General Public
11 # License or the Artistic License, as specified in the README file.
12 #
13  
14 2 ▶sub default_options {
Subroutine default_options: called CC=1 SCAR=0.0
Pod documented
15 {
16 2 autoplugin => {
17 mp3 => "MP3",
18 m4a => "M4A",
19 m4p => "M4A",
20 mp4 => "M4A",
21 m4b => "M4A",
22 '3gp' => "M4A",
23 ogg => "OGG",
24 flac => "FLAC"
25 }
26 }
27 }
28  
29 2 ▶sub new {
Subroutine new: called CC=8 SCAR=21.0
Pod documented
30 2 my $class = shift;
31 2 my $parent = shift;
32 2 ▶ my $options = shift || {};
Condition50%1/2
shift() || {}
l!l
20
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
33 2 my $self = {};
34 2 bless $self, $class;
35 2 $self->info($parent);
36 2 $self->options($options);
37 2 my $plugin = "";
38 2 ▶ if ( $self->info->get_data('filename') =~ /\.([^\.]*)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->info->get_data("filename") =~ /\.([^\.]*)$/) 2 0 2
39 2 ▶ if (exists $self->options->{autoplugin}->{lc($1)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->options->{"autoplugin"}{lc $1}) 1 1 2
40 1 $plugin = $self->options->{autoplugin}->{lc($1)};
41 }
42 }
43 2 ▶ if (($plugin) && ($self->info->available_plugins($plugin))) {
Branch: 1 branch
BranchTrueFalseTotal
if ($plugin and $self->info->available_plugins($plugin)) { } 1 1 2
Condition66%2/3
$plugin and $self->info->available_plugins($plugin)
!ll&&!rl&&r
101
MC/DC50%1/2
$plugin and $self->info->available_plugins($plugin)
$plugin $self->info->available_plugins($plugin)
Truth table66%2/3
A and B
A= $pluginB= $self->info->available_plugins($plugin)
ABresult
0X0
100
111
44 1 ▶ unless ( $plugin =~ /::/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($plugin =~ /::/) 1 0 1
45 1 $plugin = "Music::Tag::" . $plugin;
46 }
47 1 $self->status(1, "Auto loading plugin: $plugin");
48 1 my $type = lc($plugin);
49 1 $type =~ s/^.*:://;
50 1 $self->status(2, "Adding filetype: $plugin");
51 1 $self->info->set_data('filetype',$type);
52 1 ▶ if($self->info->_has_module($plugin)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->info->_has_module($plugin)) 1 0 1
53 1 return $plugin->new( $self->info, $self->options );
54 }
55 }
56 else {
57 1 $self->error("Sorry, I can't find a plugin for ", $self->info->get_data('filename'));
58 1 return undef;
59 }
60 }
61  
62 2 1;
63 __END__
« Tag.pm ↑ Summary Tag/Option.pm »