| 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::XPathValueList; | ||||||||||
| 5 | 15 | $XML::Rabbit::Trait::XPathValueList::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 value xpath extractor trait | ||||||||||
| 11 | |||||||||||
| 12 | 6 | ▶ | around '_process_options' => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
| |||||||||||
| 13 | 6 | my ($orig, $self, $name, $options, @rest) = @_; | |||||||||
| 14 | |||||||||||
| 15 | 6 | $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 | 6 | ▶ | confess("isa attribute is required") unless defined( $options->{'isa'} ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 15 | }; | |||||||||
| 22 | |||||||||||
| 23 | |||||||||||
| 24 | 4 | ▶ | sub _build_default { | ||||||||
|
Subroutine
_build_default: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 4 | my ($self) = @_; | |||||||||
| 26 | 4 | ▶ | return sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 27 | 4 | my ($parent) = @_; | |||||||||
| 28 | 4 | my $xpath_query = $self->_resolve_xpath_query( $parent ); | |||||||||
| 29 | 4 | my @nodes; | |||||||||
| 30 | 4 | foreach my $node ( $self->_find_nodes( $parent, $xpath_query ) ) { | |||||||||
| 31 | 4 | push @nodes, $node->to_literal . ""; | |||||||||
| 32 | } | ||||||||||
| 33 | 4 | return \@nodes; | |||||||||
| 34 | 4 | }; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 15 | Moose::Util::meta_attribute_alias('XPathValueList'); | |||||||||
| 38 | |||||||||||
| 39 | 15 | ▶ | no Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 40 | |||||||||||
| 41 | 15 | 1; | |||||||||
| 42 | |||||||||||
| 43 | __END__ | ||||||||||