Rabbit/Trait/XPathObjectList.pm

filter: Statementstmt 100% 32 / 32 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 97.6% 41 / 42 CC 3 SCAR 3.4
CC
3
Cov
97%
__ANON__
2.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.4
« Rabbit/RootNode.pm ↑ Summary Rabbit/Trait/XPathValue.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::XPathObjectList;
5 15 $XML::Rabbit::Trait::XPathObjectList::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: Multiple XML DOM object xpath extractor trait
11  
12 17 ▶around '_process_options' => sub {
Subroutine __ANON__: called CC=2 SCAR=7.1
13 17 my ($orig, $self, $name, $options, @rest) = @_;
14  
15 17 $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 17 ▶ confess("isa attribute is required") unless defined( $options->{'isa'} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $options->{"isa"} 0 17 17
21 15 };
22  
23  
24 has 'isa_map' => (
25 is => 'ro',
26 isa => 'HashRef[Str]',
27 lazy => 1,
28 7 ▶ 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=2 SCAR=6.9
35 15 my ($parent) = @_;
36 15 my $xpath_query = $self->_resolve_xpath_query( $parent );
37 15 $self->_convert_isa_map( $parent );
38 15 my $class = $self->_resolve_class();
39 15 my @nodes;
40 15 foreach my $node ( $self->_find_nodes($parent, $xpath_query ) ) {
41 459 push @nodes, $self->_create_instance( $parent, $class, $node );
42 }
43 15 return \@nodes;
44 15 };
45 }
46  
47 15 Moose::Util::meta_attribute_alias('XPathObjectList');
48  
49 15 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
50  
51 15 1;
52  
53 __END__
« Rabbit/RootNode.pm ↑ Summary Rabbit/Trait/XPathValue.pm »