| 1 | package Test::BDD::Infrastructure::Config::Hash; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | # ABSTRACT: configuration class for Test::BDD::Infrastructure | ||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | our $VERSION = '1.005'; # VERSION | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | has 'config' => ( is => 'rw', isa => 'HashRef', required => 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | ▶ | sub _get_hash_node { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_hash_node: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | my $hash = shift; | |||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | my @path = @_; | |||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | my $cur = $hash; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | if( ! defined $hash ) { return; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | while( my $element = shift @path ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | if( defined $cur->{$element} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $cur->{$element} and ref $cur->{$element} eq "HASH"
MC/DC0%0/2
defined $cur->{$element} and ref $cur->{$element} eq "HASH"
defined $cur->{$element}
ref $cur->{$element} eq "HASH"
Truth table0%0/3
A and B
A= defined $cur->{$element}B= ref $cur->{$element} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | && ref $cur->{$element} eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | $cur = $cur->{$element}; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | } else { return; } | |||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | return $cur; | |||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | sub _get_hash_value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_hash_value: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | my $hash = shift; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | my $key = pop; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | my @path = @_; | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my $cur = _get_hash_node( $hash, @path ); | |||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if( defined $cur | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $cur and defined $cur->{$key} and not ref $cur->{$key}
defined $cur and defined $cur->{$key}
MC/DC0%0/3
defined $cur and defined $cur->{$key} and not ref $cur->{$key}
defined $cur
defined $cur->{$key}
not ref $cur->{$key}
Truth table0%0/4
A and B and not(C)
A= defined $curB= defined $cur->{$key}C= not ref $cur->{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | && defined $cur->{$key} | ||||||||||||||||||||||||||||||||||||||||||
| 36 | && ! ref($cur->{$key}) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | return $cur->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub _parse_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_path: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my ( $self, $path ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | $path =~ s/^\///; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | return( split('/', $path) ); | |||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub get_node { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_node: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my ( $self, $path ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | my $node; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | if( $node = _get_hash_node( $self->config, $self->_parse_path( $path ) ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my ( $self, $path ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my $value; | |||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if( $value = _get_hash_value( $self->config, $self->_parse_path( $path ) ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | return $value; | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | __END__ | ||||||||||||||||||||||||||||||||||||||||||