Tools/EUtilities/Info.pm

filter: Statementstmt 82.0% 41 / 50 Branchbran 63.6% 14 / 22 Conditioncond 83.3% 5 / 6 MC/DCmcdc 75.0% 3 / 4 Subroutinesub 87.5% 7 / 8 Podpod 100% 1 / 1 totaltotal 78.0% 71 / 91 CC 16 SCAR 24.1
CC
16
Cov
77%
to_string
20.0
_add_data
13.1
BEGIN
1.0
CRAP 11.1
« Tools/EUtilities/Link.pm ↑ Summary Tools/EUtilities/Summary/Item.pm »
1 package Bio::Tools::EUtilities::Info;
2 2 our $AUTHORITY = 'cpan:BIOPERLML';
3 2 $Bio::Tools::EUtilities::Info::VERSION = '1.74';
4 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use base qw(Bio::Tools::EUtilities Bio::Tools::EUtilities::EUtilDataI);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Bio::Tools::EUtilities::Info::LinkInfo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Bio::Tools::EUtilities::Info::FieldInfo;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # ABSTRACT: Interface class for storing einfo data.
12 # AUTHOR: Chris Fields <cjfields@bioperl.org>
13 # OWNER: 2006-2013 Chris Fields
14 # LICENSE: Perl_5
15  
16  
17  
18  
19 # private EUtilDataI method
20  
21 sub _add_data {
22 2 ▶ my ($self, $simple) = @_;
Subroutine _add_data: called CC=13 SCAR=25.7
23 2 ▶ if (exists $simple->{DbList} &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $simple->{"DbList"} and exists $simple->{"DbList"}{"DbName"}) 1 1 2
Condition66%2/3
exists $simple->{"DbList"} and exists $simple->{"DbList"}{"DbName"}
!ll&&!rl&&r
101
MC/DC50%1/2
exists $simple->{"DbList"} and exists $simple->{"DbList"}{"DbName"}
exists $simple->{"DbList"} exists $simple->{"DbList"}{"DbName"}
Truth table66%2/3
A and B
A= exists $simple->{"DbList"}B= exists $simple->{"DbList"}{"DbName"}
ABresult
0X0
100
111
24 exists $simple->{DbList}->{DbName}) {
25 1 $self->{'_available_databases'} = $simple->{DbList}->{DbName};
26 }
27 # start setting internal variables
28 2 ▶ if (exists $simple->{DbInfo}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $simple->{'DbInfo'}) { } 1 1 2
29 1 for my $key (sort keys %{ $simple->{DbInfo} }) {
30 my $data =
31 ($key eq 'FieldList') ? $simple->{DbInfo}->{$key}->{Field} :
32 ($key eq 'LinkList' ) ? $simple->{DbInfo}->{$key}->{Link} :
33 7 ▶ $simple->{DbInfo}->{$key};
Branch: 2 branches
BranchTrueFalseTotal
$key eq 'FieldList' ? : 1 6 7
$key eq 'LinkList' ? : 1 5 6
34 7 ▶ if ($key eq 'FieldList' || $key eq 'LinkList') {
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq 'FieldList' or $key eq 'LinkList') { } 2 5 7
Condition100%3/3
$key eq "FieldList" or $key eq "LinkList"
l!l&&r!l&&!r
115
MC/DC100%2/2
$key eq "FieldList" or $key eq "LinkList"
$key eq "FieldList" $key eq "LinkList"
Truth table100%3/3
A or B
A= $key eq "FieldList"B= $key eq "LinkList"
ABresult
1X1
011
000
35 2 for my $chunk (@{$data}) {
36 87 ▶ if (exists $simple->{DbInfo}->{DbName}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $simple->{"DbInfo"}{"DbName"}) 87 0 87
37 87 $chunk->{DbFrom} = $simple->{DbInfo}->{DbName};
38 }
39 87 ▶ my $type = ($key eq 'FieldList') ? 'FieldInfo' : 'LinkInfo';
Branch: 1 branch
BranchTrueFalseTotal
$key eq 'FieldList' ? : 41 46 87
40 87 my $obj = "Bio::Tools::EUtilities::Info::$type"->new(
41 -eutil => 'einfo',
42 -type => lc $type,
43 -verbose => $self->verbose);
44 87 $obj->_add_data($chunk);
45 87 push @{ $self->{'_'.lc $type} }, $obj;
46 }
47 } else {
48 5 $self->{'_'.lc $key} = $data;
49 }
50 }
51 } else {
52 1 ▶ map { $self->{'_'.lc $_} = $simple->{$_} unless ref $simple->{$_}} keys %$simple;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $simple->{$_} 0 1 1
53 }
54 }
55  
56  
57 sub to_string {
58 0 ▶ my $self = shift;
Subroutine to_string: not called CC=4 SCAR=30.0
Pod documented
59 0 my $string = $self->SUPER::to_string;
60 0 ▶ if (my @dbs = $self->get_databases) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@dbs) = $self->get_databases) 0 0 0
61 0 $string .= sprintf("%-20s:%s\n\n", 'DB',
62 $self->_text_wrap('', ' 'x20 .':', join(', ',@dbs)));
63 }
64 0 ▶ while (my $fi = $self->next_FieldInfo) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $fi = $self->next_FieldInfo) 0 0 0
65 0 $string .= $fi->to_string."\n";
66 }
67 0 ▶ while (my $li = $self->next_LinkInfo) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $li = $self->next_LinkInfo) 0 0 0
68 0 $string .= $li->to_string."\n";
69 }
70 0 return $string;
71 }
72  
73 2 1;
74  
75 __END__
« Tools/EUtilities/Link.pm ↑ Summary Tools/EUtilities/Summary/Item.pm »