| 1 | package Data::YADV::Structure::Array; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use base 'Data::YADV::Structure::Base'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 18 | ▶ | sub _get_child_node { | ||||||||
|
Subroutine
_get_child_node: called CC=3 SCAR=11.0
| |||||||||||
| 9 | 18 | my ($self, $entry) = @_; | |||||||||
| 10 | |||||||||||
| 11 | 18 | ▶ | $self->die(qq(Wrong array index), $entry) unless $entry =~ /^\[(.+)\]$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | 18 | my $index = $1; | |||||||||
| 13 | |||||||||||
| 14 | 18 | my $structure = $self->get_structure; | |||||||||
| 15 | 18 | ▶ | return undef unless abs($index) < scalar @$structure; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | |||||||||||
| 17 | 17 | $self->_build_node($entry, $structure->[$index]); | |||||||||
| 18 | }; | ||||||||||
| 19 | |||||||||||
| 20 | 2 | ▶ | sub get_size { scalar @{$_[0]->get_structure} } | ||||||||
|
Subroutine
get_size: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 21 | |||||||||||
| 22 | 1 | ▶ | sub each { | ||||||||
|
Subroutine
each: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 23 | 1 | my ($self, $cb) = @_; | |||||||||
| 24 | |||||||||||
| 25 | 1 | my $size = $self->get_size; | |||||||||
| 26 | 1 | ▶ | for (my $i = 0; $i < $size; ++$i) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 2 | $cb->($self->get_child("[$i]"), $i); | |||||||||
| 28 | } | ||||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 1 | 1; | |||||||||