lib/Convert/Pheno/CDISC/ODM/Util.pm

filter: Statementstmt 94.5% 35 / 37 Branchbran 65.0% 13 / 20 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 5 totaltotal 78.6% 59 / 75 CC 13 SCAR 15.4
CC
13
Cov
83%
element_text
8.5
children
5.0
as_array
3.0
CRAP 4.7
« lib/Convert/Pheno/OMOP/ToBFF/Biosamples.pm ↑ Summary lib/Convert/Pheno/PXF/ToBFF.pm »
1 package Convert::Pheno::CDISC::ODM::Util;
2  
3 136 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 136 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 136 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 136 our @EXPORT_OK = qw(
9 as_array
10 attr
11 child
12 children
13 element_text
14 );
15  
16 12794 ▶sub as_array {
Subroutine as_array: called CC=3 SCAR=11.0
Pod undocumented
17 12794 my ($value) = @_;
18 12794 ▶ return [] unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 12794 12794
19 12794 ▶ return $value if ref($value) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if ref $value eq "ARRAY" 6594 6200 12794
20 6200 return [$value];
21 }
22  
23 3275 ▶sub children {
Subroutine children: called CC=5 SCAR=16.2
Pod undocumented
24 3275 my ( $node, $local_name ) = @_;
25 3275 ▶ return [] unless ref($node) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $node eq "HASH" 0 3275 3275
26  
27 3275 my @values;
28 3275 for my $key ( sort keys %{$node} ) {
29 11537 ▶ next unless $key eq $local_name || $key =~ /:\Q$local_name\E\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless $key eq $local_name or $key =~ /:\Q$local_name\E\z/ 8718 2819 11537
Condition66%2/3
$key eq $local_name or $key =~ /:\Q$local_name\E\z/
l!l&&r!l&&!r
281908718
MC/DC50%1/2
$key eq $local_name or $key =~ /:\Q$local_name\E\z/
$key eq $local_name $key =~ /:\Q$local_name\E\z/
Truth table66%2/3
A or B
A= $key eq $local_nameB= $key =~ /:\Q$local_name\E\z/
ABresult
1X1
011
000
30 2819 push @values, @{ as_array( $node->{$key} ) };
31 }
32 3275 return \@values;
33 }
34  
35 861 ▶sub child {
Subroutine child: called CC=1 SCAR=0.0
Pod undocumented
36 861 my ( $node, $local_name ) = @_;
37 861 my $values = children( $node, $local_name );
38 861 return $values->[0];
39 }
40  
41 177008 ▶sub attr {
Subroutine attr: called CC=2 SCAR=6.9
Pod undocumented
42 177008 my ( $node, $local_name ) = @_;
43 177008 ▶ return unless ref($node) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $node eq "HASH" 6 177002 177008
44 177002 return $node->{ '-' . $local_name };
45 }
46  
47 435 ▶sub element_text {
Subroutine element_text: called CC=6 SCAR=21.4
Pod undocumented
48 435 my ($node) = @_;
49 435 ▶ return unless defined $node;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $node 0 435 435
50 435 ▶ return "$node" unless ref($node);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $node 18 417 435
51 417 ▶ return unless ref($node) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $node eq "HASH" 0 417 417
52  
53 417 ▶ return $node->{'~'} if exists $node->{'~'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $node->{"~"} 417 0 417
54 0 ▶ return $node->{'#text'} if exists $node->{'#text'};
Branch: 1 branch
BranchTrueFalseTotal
if exists $node->{"#text"} 0 0 0
55 0 return;
56 }
57  
58 136 1;
« lib/Convert/Pheno/OMOP/ToBFF/Biosamples.pm ↑ Summary lib/Convert/Pheno/PXF/ToBFF.pm »