| 1 | package YAML::Ordered::Conditional; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 14 | ▶ | use 5.006; use strict; use warnings; our $VERSION = '0.04'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 14 | ▶ | use YAML::As::Parsed qw/Dump DumpFile Load LoadFile/; use base 'Struct::Conditional'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 14 | ▶ | use Tie::IxHash; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | sub encode { | ||||||||||||||||||||||||||||
| 8 | 0 | ▶ | Dump($_[1]); | ||||||||||||||||||||||||||
|
Subroutine
encode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 9 | } | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | sub encode_file { | ||||||||||||||||||||||||||||
| 12 | 0 | ▶ | DumpFile($_[1], $_[2]); | ||||||||||||||||||||||||||
|
Subroutine
encode_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | sub decode { | ||||||||||||||||||||||||||||
| 16 | 15 | ▶ | if ($_[1] !~ m/\n/ && -f $_[1]) { | ||||||||||||||||||||||||||
|
Subroutine
decode: called CC=3 SCAR=14.2
Pod
documented
Branch: 1 branch
Condition33%1/3
not $_[1] =~ /\n/ and -f $_[1]
MC/DC0%0/2
not $_[1] =~ /\n/ and -f $_[1]
not $_[1] =~ /\n/
-f $_[1]
Truth table33%1/3
not(A) and B
A= not $_[1] =~ /\n/B= -f $_[1]
| |||||||||||||||||||||||||||||
| 17 | 0 | return $_[0]->decode_file($_[1]); | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | 15 | Load($_[1]); | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | sub decode_file { | ||||||||||||||||||||||||||||
| 23 | 0 | ▶ | LoadFile($_[1], $_[2]); | ||||||||||||||||||||||||||
|
Subroutine
decode_file: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | sub compile { | ||||||||||||||||||||||||||||
| 27 | 15 | ▶ | my ($self, $yaml, $params, $return_struct, $out_file) = @_; | ||||||||||||||||||||||||||
|
Subroutine
compile: called CC=5 SCAR=18.6
Pod
documented
| |||||||||||||||||||||||||||||
| 28 | 15 | ▶ | $yaml = $self->decode($yaml) unless ref $yaml; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 15 | ▶ | $params = $self->decode($params) unless ref $params; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 15 | $yaml = $self->SUPER::compile($yaml, $params); | |||||||||||||||||||||||||||
| 31 | 15 | ▶ | return $return_struct | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 32 | ? $yaml | ||||||||||||||||||||||||||||
| 33 | : $out_file | ||||||||||||||||||||||||||||
| 34 | ? $self->encode_file($out_file, $yaml) | ||||||||||||||||||||||||||||
| 35 | : $self->encode($yaml); | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | sub instantiate_hash { | ||||||||||||||||||||||||||||
| 39 | 2 | ▶ | my %hash; | ||||||||||||||||||||||||||
|
Subroutine
instantiate_hash: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 40 | 2 | tie %hash, 'Tie::IxHash'; | |||||||||||||||||||||||||||
| 41 | 2 | return %hash; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 14 | 1; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | __END__ | ||||||||||||||||||||||||||||