| 1 | package Data::YADV::Structure::Hash; | ||||||||||
| 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 | 14 | ▶ | sub _get_child_node { | ||||||||
|
Subroutine
_get_child_node: called CC=3 SCAR=11.0
| |||||||||||
| 9 | 14 | my ($self, $entry) = @_; | |||||||||
| 10 | |||||||||||
| 11 | 14 | ▶ | die qq(Wrong hash key format "$entry") | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | unless $entry =~ /^\{(.+)\}$/; | ||||||||||
| 13 | 14 | my $key = $1; | |||||||||
| 14 | |||||||||||
| 15 | 14 | my $structure = $self->get_structure; | |||||||||
| 16 | 14 | ▶ | return undef unless exists $structure->{$key}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | |||||||||||
| 18 | 13 | $self->_build_node($entry, $structure->{$key}) | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 1 | ▶ | sub get_size { keys %{$_[0]->get_structure} } | ||||||||
|
Subroutine
get_size: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 22 | |||||||||||
| 23 | 1 | ▶ | sub each { | ||||||||
|
Subroutine
each: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 24 | 1 | my ($self, $cb) = @_; | |||||||||
| 25 | |||||||||||
| 26 | 1 | foreach my $key (keys %{$self->get_structure}) { | |||||||||
| 27 | 2 | $cb->($self->get_child("{$key}"), $key); | |||||||||
| 28 | } | ||||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 1 | 1; | |||||||||