Elemental/Document.pm

filter: Statementstmt 100% 16 / 16 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 66.6% 2 / 3 totaltotal 88.2% 30 / 34 CC 5 SCAR 8.4
CC
5
Cov
92%
contents
4.1
DESTROY
2.0
BEGIN
1.0
CRAP 2.3
« Elemental/Element.pm ↑ Summary Elemental.pm »
1 package XML::Elemental::Document;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use base qw( XML::Elemental::Node );
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶sub root_element { $_[0]->{contents} }
Subroutine root_element: called CC=1 SCAR=0.0
Pod documented
8  
9 5 ▶sub contents {
Subroutine contents: called CC=4 SCAR=14.2
Pod documented
10 5 ▶ if (@_ > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 1) 1 4 5
11 1 ▶ $_[0]->{contents} = ref $_[1] eq 'ARRAY' ? $_[1]->[0] : $_[1];
Branch: 1 branch
BranchTrueFalseTotal
ref $_[1] eq 'ARRAY' ? : 1 0 1
12 1 weaken($_[0]->{contents}->{parent} = $_[0]);
13 }
14 5 ▶ return $_[0]->{contents} ? [$_[0]->{contents}] : [];
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{'contents'} ? : 5 0 5
15 }
16  
17 0 ▶sub attributes { } # deprecated. documents never have attributes.
Subroutine attributes: not called CC=1 SCAR=0.0
Pod undocumented
18  
19 4 ▶sub DESTROY {
Subroutine DESTROY: called CC=2 SCAR=6.9
20 4 ▶ $_[0]->{contents}->DESTROY if $_[0]->{contents};
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"contents"} 3 1 4
21 } # starts circular reference teardown
22  
23 3 1;
24  
25 __END__
« Elemental/Element.pm ↑ Summary Elemental.pm »