Rabbit/RootNode.pm

filter: Statementstmt 100% 42 / 42 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod n/a totaltotal 98.2% 55 / 56 CC 3 SCAR 3.6
CC
3
Cov
98%
_build__xpc
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Rabbit/Trait/XPathValueList.pm ↑ Summary Rabbit/Trait/XPathObjectList.pm »
1 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package XML::Rabbit::RootNode;
5 14 $XML::Rabbit::RootNode::VERSION = '0.4.1';
6 14 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 14 with 'XML::Rabbit::Role::Document';
8  
9 # ABSTRACT: Root node base class
10  
11 # Preload XPath attribute traits
12 14 ▶use XML::Rabbit::Trait::XPathValue;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 14 ▶use XML::Rabbit::Trait::XPathValueList;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 14 ▶use XML::Rabbit::Trait::XPathValueMap;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 14 ▶use XML::Rabbit::Trait::XPathObject;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 14 ▶use XML::Rabbit::Trait::XPathObjectList;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 14 ▶use XML::Rabbit::Trait::XPathObjectMap;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 14 with 'XML::Rabbit::Role::Node' => {
20 'node' => { lazy => 1, builder => '_build__node' },
21 'xpc' => { lazy => 1, builder => '_build__xpc' },
22 };
23  
24  
25 13 ▶sub _build__node {
Subroutine _build__node: called CC=1 SCAR=0.0
26 13 return shift->_document->documentElement();
27 }
28  
29  
30 13 ▶sub _build__xpc {
Subroutine _build__xpc: called CC=3 SCAR=11.0
31 13 my ($self) = @_;
32 # XML::LibXML loads this class, see XML::Rabbit::Role::Document
33 13 my $xpc = XML::LibXML::XPathContext->new( $self->_document );
34  
35 # Make sure namespace_map is inherited from XML::Rabbit::Role::Node
36 13 ▶ confess("Required role 'XML::Rabbit::Role::Node' not composed") unless $self->does('XML::Rabbit::Role::Node');
Branch: 1 branch
BranchTrueFalseTotal
unless $self->does("XML::Rabbit::Role::Node") 0 13 13
37  
38 # Register all prefixes specified in namespace_map for use in xpath queries
39 13 foreach my $prefix ( keys %{ $self->namespace_map } ) {
40 12 $xpc->registerNs($prefix, $self->namespace_map->{$prefix});
41 }
42 13 return $xpc;
43 }
44  
45 14 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
46  
47 14 1;
48  
49 __END__
« Rabbit/Trait/XPathValueList.pm ↑ Summary Rabbit/Trait/XPathObjectList.pm »