| 1 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | package Data::ZPath::NodeList; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 8 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 8 | our $VERSION = '0.001000'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 39 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 39 | my ( $class, @nodes ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 39 | return bless \@nodes, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 379 | ▶ | sub _new_or_list { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new_or_list: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 379 | my ( $class, @nodes ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 379 | ▶ | wantarray ? @nodes : $class->new( @nodes ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 24 | ▶ | sub all { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
all: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 24 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 24 | return @$self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | ▶ | sub values { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
values: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 2 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | return map $_->value, @$self; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 9 | ▶ | sub first { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
first: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 9 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 9 | return $self->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 3 | ▶ | sub last { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
last: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 3 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 3 | return $self->[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 2 | ▶ | sub find { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 2 | require Data::ZPath; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 2 | my ( $self, $zpath ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 2 | ▶ | $zpath = Data::ZPath->new( $zpath ) unless blessed($zpath); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 2 | return ref($self)->_new_or_list( map $_->find($zpath), $self->all ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | ▶ | sub grep { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grep: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | my ( $self, $cb ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | ref($self)->_new_or_list( grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | my $node = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 3 | local $_ = $node->value; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 3 | $cb->(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } $self->all ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | ▶ | sub map { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
map: called CC=5 SCAR=18.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | my ( $self, $cb ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | ref($self)->_new_or_list( map { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | my $node = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 3 | local $_ = $node->value; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 3 | my $new = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 3 | ▶ | blessed($new) && $new->isa('Data::ZPath::NodeList') ? $new->all : | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
builtin::blessed($new) and $new->isa("Data::ZPath::NodeList")
builtin::blessed($new) and $new->isa("Data::ZPath::Node")
MC/DC0%0/2
builtin::blessed($new) and $new->isa("Data::ZPath::NodeList")
builtin::blessed($new)
$new->isa("Data::ZPath::NodeList")
MC/DC0%0/2
builtin::blessed($new) and $new->isa("Data::ZPath::Node")
builtin::blessed($new)
$new->isa("Data::ZPath::Node")
Truth table33%1/3
A and B
A= builtin::blessed($new)B= $new->isa("Data::ZPath::NodeList")
Truth table33%1/3
A and B
A= builtin::blessed($new)B= $new->isa("Data::ZPath::Node")
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | blessed($new) && $new->isa('Data::ZPath::Node') ? $new : | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | Data::ZPath::Node->from_root( $new ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } $cb->(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } $self->all ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||