Rabbit/Trait/XPathObject.pm

filter: Statementstmt 100% 29 / 29 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 97.4% 38 / 39 CC 2 SCAR 2.1
CC
2
Cov
97%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Rabbit/Trait/XPathValue.pm ↑ Summary Rabbit/Role/Node.pm »
1 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 15 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package XML::Rabbit::Trait::XPathObject;
5 15 $XML::Rabbit::Trait::XPathObject::VERSION = '0.4.1';
6 15 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 15 with 'XML::Rabbit::Trait::XPath';
9  
10 # ABSTRACT: XML DOM object xpath extractor trait
11  
12 15 ▶around '_process_options' => sub {
Subroutine __ANON__: called CC=2 SCAR=7.1
13 15 my ($orig, $self, $name, $options, @rest) = @_;
14  
15 15 $self->$orig($name, $options, @rest);
16  
17 # This should really be:
18 # has '+isa' => ( required => 1 );
19 # but for some unknown reason Moose doesn't allow that
20 15 ▶ confess("isa attribute is required") unless defined( $options->{'isa'} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $options->{"isa"} 0 15 15
21 15 };
22  
23  
24 has 'isa_map' => (
25 is => 'ro',
26 isa => 'HashRef[Str]',
27 lazy => 1,
28 13 ▶ default => sub { +{} },
Subroutine __ANON__: called CC=1 SCAR=0.0
29 15 );
30  
31  
32 15 ▶sub _build_default {
Subroutine _build_default: called CC=1 SCAR=0.0
33 15 my ($self) = @_;
34 15 ▶ return sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
35 15 my ($parent) = @_;
36 15 my $node = $self->_find_node(
37 $parent,
38 $self->_resolve_xpath_query( $parent ),
39 );
40 15 $self->_convert_isa_map( $parent );
41 15 my $class = $self->_resolve_class();
42 15 return $self->_create_instance( $parent, $class, $node );
43 15 };
44 }
45  
46 15 Moose::Util::meta_attribute_alias('XPathObject');
47  
48 15 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
49  
50 15 1;
51  
52 __END__
« Rabbit/Trait/XPathValue.pm ↑ Summary Rabbit/Role/Node.pm »