| 1 | package YAML::Syck; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # See documentation after the __END__ mark. | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 72 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 72 | our ( $Headless, $SingleQuote, $ImplicitBinary, $ImplicitTyping, $ImplicitUnicode, $UseCode, $LoadCode, $DumpCode, $DeparseObject, $MaxDepth ); | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 72 | ▶ | use 5.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 72 | ▶ | use Exporter; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 72 | ▶ | use XSLoader (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 72 | our $VERSION = '1.47'; | |||||||||||||||||||||||||||
| 14 | 72 | our @EXPORT = qw( Dump Load DumpFile LoadFile ); | |||||||||||||||||||||||||||
| 15 | 72 | our @EXPORT_OK = qw( DumpInto LoadBytes LoadUTF8 DumpBytes DumpUTF8 ); | |||||||||||||||||||||||||||
| 16 | 72 | our @ISA = qw( Exporter ); | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 72 | our $SortKeys = 1; | |||||||||||||||||||||||||||
| 19 | 72 | our $LoadBlessed = 0; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 72 | XSLoader::load( 'YAML::Syck', $VERSION ); | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 72 | ▶ | use constant QR_MAP => { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=3.4
| |||||||||||||||||||||||||||||
| 24 | 5 | ▶ | '' => sub { qr{$_[0]} }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | x => sub { qr{$_[0]}x }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 26 | 2 | ▶ | i => sub { qr{$_[0]}i }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | 0 | ▶ | s => sub { qr{$_[0]}s }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | m => sub { qr{$_[0]}m }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | ix => sub { qr{$_[0]}ix }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sx => sub { qr{$_[0]}sx }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | mx => sub { qr{$_[0]}mx }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | si => sub { qr{$_[0]}si }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 33 | 0 | ▶ | mi => sub { qr{$_[0]}mi }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | ms => sub { qr{$_[0]}sm }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 35 | 0 | ▶ | six => sub { qr{$_[0]}six }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | mix => sub { qr{$_[0]}mix }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | msx => sub { qr{$_[0]}msx }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 38 | 0 | ▶ | msi => sub { qr{$_[0]}msi }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | msix => sub { qr{$_[0]}msix }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 40 | 72 | }; | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 7 | ▶ | sub __qr_helper { | ||||||||||||||||||||||||||
|
Subroutine
__qr_helper: called CC=3 SCAR=13.3
| |||||||||||||||||||||||||||||
| 43 | 7 | ▶ | if ( $_[0] =~ /\A \(\? \^? ([ixsm]*) (?:- (?:[ixsm]*))? : (.*) \) \z/x ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 44 | 7 | ▶ | my $sub = QR_MAP()->{$1} || QR_MAP()->{''}; | ||||||||||||||||||||||||||
|
Condition33%1/3
{ => sub {
qr/$_[0]/;
}
, i => sub {
qr/$_[0]/i;
}
, ix => sub {
qr/$_[0]/xi;
}
, m => sub {
qr/$_[0]/m;
}
, mi => sub {
qr/$_[0]/im;
}
, mix => sub {
qr/$_[0]/mix;
}
, ms => sub {
qr/$_[0]/ms;
}
, msi => sub {
qr/$_[0]/ism;
}
, msix => sub {
qr/$_[0]/imsx;
}
, msx => sub {
qr/$_[0]/msx;
}
, mx => sub {
qr/$_[0]/mx;
}
, s => sub {
qr/$_[0]/s;
}
, si => sub {
qr/$_[0]/is;
}
, six => sub {
qr/$_[0]/six;
}
, sx => sub {
qr/$_[0]/sx;
}
, x => sub {
qr/$_[0]/x;
}
}->{$1} || { => sub {
qr/$_[0]/;
}
, i => sub {
qr/$_[0]/i;
}
, ix => sub {
qr/$_[0]/xi;
}
, m => sub {
qr/$_[0]/m;
}
, mi => sub {
qr/$_[0]/im;
}
, mix => sub {
qr/$_[0]/mix;
}
, ms => sub {
qr/$_[0]/ms;
}
, msi => sub {
qr/$_[0]/ism;
}
, msix => sub {
qr/$_[0]/imsx;
}
, msx => sub {
qr/$_[0]/msx;
}
, mx => sub {
qr/$_[0]/mx;
}
, s => sub {
qr/$_[0]/s;
}
, si => sub {
qr/$_[0]/is;
}
, six => sub {
qr/$_[0]/six;
}
, sx => sub {
qr/$_[0]/sx;
}
, x => sub {
qr/$_[0]/x;
}
}->{''}
MC/DC0%0/2
{ => sub {
qr/$_[0]/;
}
, i => sub {
qr/$_[0]/i;
}
, ix => sub {
qr/$_[0]/xi;
}
, m => sub {
qr/$_[0]/m;
}
, mi => sub {
qr/$_[0]/im;
}
, mix => sub {
qr/$_[0]/mix;
}
, ms => sub {
qr/$_[0]/ms;
}
, msi => sub {
qr/$_[0]/ism;
}
, msix => sub {
qr/$_[0]/imsx;
}
, msx => sub {
qr/$_[0]/msx;
}
, mx => sub {
qr/$_[0]/mx;
}
, s => sub {
qr/$_[0]/s;
}
, si => sub {
qr/$_[0]/is;
}
, six => sub {
qr/$_[0]/six;
}
, sx => sub {
qr/$_[0]/sx;
}
, x => sub {
qr/$_[0]/x;
}
}->{$1} || { => sub {
qr/$_[0]/;
}
, i => sub {
qr/$_[0]/i;
}
, ix => sub {
qr/$_[0]/xi;
}
, m => sub {
qr/$_[0]/m;
}
, mi => sub {
qr/$_[0]/im;
}
, mix => sub {
qr/$_[0]/mix;
}
, ms => sub {
qr/$_[0]/ms;
}
, msi => sub {
qr/$_[0]/ism;
}
, msix => sub {
qr/$_[0]/imsx;
}
, msx => sub {
qr/$_[0]/msx;
}
, mx => sub {
qr/$_[0]/mx;
}
, s => sub {
qr/$_[0]/s;
}
, si => sub {
qr/$_[0]/is;
}
, six => sub {
qr/$_[0]/six;
}
, sx => sub {
qr/$_[0]/sx;
}
, x => sub {
qr/$_[0]/x;
}
}->{''}
{ => sub {
qr/$_[0]/;
}
, i => sub {
qr/$_[0]/i;
}
, ix => sub {
qr/$_[0]/xi;
}
, m => sub {
qr/$_[0]/m;
}
, mi => sub {
qr/$_[0]/im;
}
, mix => sub {
qr/$_[0]/mix;
}
, ms => sub {
qr/$_[0]/ms;
}
, msi => sub {
qr/$_[0]/ism;
}
, msix => sub {
qr/$_[0]/imsx;
}
, msx => sub {
qr/$_[0]/msx;
}
, mx => sub {
qr/$_[0]/mx;
}
, s => sub {
qr/$_[0]/s;
}
, si => sub {
qr/$_[0]/is;
}
, six => sub {
qr/$_[0]/six;
}
, sx => sub {
qr/$_[0]/sx;
}
, x => sub {
qr/$_[0]/x;
}
}->{$1}
{ => sub {
qr/$_[0]/;
}
, i => sub {
qr/$_[0]/i;
}
, ix => sub {
qr/$_[0]/xi;
}
, m => sub {
qr/$_[0]/m;
}
, mi => sub {
qr/$_[0]/im;
}
, mix => sub {
qr/$_[0]/mix;
}
, ms => sub {
qr/$_[0]/ms;
}
, msi => sub {
qr/$_[0]/ism;
}
, msix => sub {
qr/$_[0]/imsx;
}
, msx => sub {
qr/$_[0]/msx;
}
, mx => sub {
qr/$_[0]/mx;
}
, s => sub {
qr/$_[0]/s;
}
, si => sub {
qr/$_[0]/is;
}
, six => sub {
qr/$_[0]/six;
}
, sx => sub {
qr/$_[0]/sx;
}
, x => sub {
qr/$_[0]/x;
}
}->{''}
Truth table33%1/3
A || B
A= { => sub {
qr/$_[0]/;
}
, i => sub {
qr/$_[0]/i;
}
, ix => sub {
qr/$_[0]/xi;
}
, m => sub {
qr/$_[0]/m;
}
, mi => sub {
qr/$_[0]/im;
}
, mix => sub {
qr/$_[0]/mix;
}
, ms => sub {
qr/$_[0]/ms;
}
, msi => sub {
qr/$_[0]/ism;
}
, msix => sub {
qr/$_[0]/imsx;
}
, msx => sub {
qr/$_[0]/msx;
}
, mx => sub {
qr/$_[0]/mx;
}
, s => sub {
qr/$_[0]/s;
}
, si => sub {
qr/$_[0]/is;
}
, six => sub {
qr/$_[0]/six;
}
, sx => sub {
qr/$_[0]/sx;
}
, x => sub {
qr/$_[0]/x;
}
}->{$1}B= { => sub {
qr/$_[0]/;
}
, i => sub {
qr/$_[0]/i;
}
, ix => sub {
qr/$_[0]/xi;
}
, m => sub {
qr/$_[0]/m;
}
, mi => sub {
qr/$_[0]/im;
}
, mix => sub {
qr/$_[0]/mix;
}
, ms => sub {
qr/$_[0]/ms;
}
, msi => sub {
qr/$_[0]/ism;
}
, msix => sub {
qr/$_[0]/imsx;
}
, msx => sub {
qr/$_[0]/msx;
}
, mx => sub {
qr/$_[0]/mx;
}
, s => sub {
qr/$_[0]/s;
}
, si => sub {
qr/$_[0]/is;
}
, six => sub {
qr/$_[0]/six;
}
, sx => sub {
qr/$_[0]/sx;
}
, x => sub {
qr/$_[0]/x;
}
}->{''}
| |||||||||||||||||||||||||||||
| 45 | 7 | &$sub($2); | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | else { | ||||||||||||||||||||||||||||
| 48 | 0 | qr/$_[0]/; | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 1213 | ▶ | sub Dump { | ||||||||||||||||||||||||||
|
Subroutine
Dump: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 53 | $#_ | ||||||||||||||||||||||||||||
| 54 | 1213 | ▶ | ? join( '', map { YAML::Syck::DumpYAML($_) } @_ ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | : YAML::Syck::DumpYAML( $_[0] ); | ||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 2194 | ▶ | sub Load { | ||||||||||||||||||||||||||
|
Subroutine
Load: called CC=6 SCAR=18.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 59 | 2194 | ▶ | if (wantarray) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 212 | ▶ | return unless defined $_[0] && length $_[0]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $_[0] and length $_[0]
MC/DC100%2/2
defined $_[0] and length $_[0]
defined $_[0]
length $_[0]
Truth table100%3/3
A and B
A= defined $_[0]B= length $_[0]
| |||||||||||||||||||||||||||||
| 61 | 210 | my ($rv) = YAML::Syck::LoadYAML( $_[0] ); | |||||||||||||||||||||||||||
| 62 | 210 | ▶ | return unless defined $rv && ref $rv eq 'ARRAY'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $rv and ref $rv eq "ARRAY"
MC/DC0%0/2
defined $rv and ref $rv eq "ARRAY"
defined $rv
ref $rv eq "ARRAY"
Truth table33%1/3
A and B
A= defined $rvB= ref $rv eq "ARRAY"
| |||||||||||||||||||||||||||||
| 63 | 210 | @{$rv}; | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | else { | ||||||||||||||||||||||||||||
| 66 | 1982 | @_ = $_[0]; | |||||||||||||||||||||||||||
| 67 | 1982 | goto &YAML::Syck::LoadYAML; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 552 | ▶ | sub _is_glob { | ||||||||||||||||||||||||||
|
Subroutine
_is_glob: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||
| 72 | 552 | my $h = shift; | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 552 | ▶ | return 1 if ( ref($h) eq 'GLOB' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | 529 | ▶ | return 1 if ( ref( \$h ) eq 'GLOB' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 76 | 523 | ▶ | return 1 if ( index( ref($h), 'IO::' ) == 0 ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 77 | 519 | ▶ | return 1 if ( ref($h) && UNIVERSAL::isa($h, 'IO::Handle') ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $h and UNIVERSAL::isa($h, "IO::Handle")
MC/DC50%1/2
ref $h and UNIVERSAL::isa($h, "IO::Handle")
ref $h
UNIVERSAL::isa($h, "IO::Handle")
Truth table66%2/3
A and B
A= ref $hB= UNIVERSAL::isa($h, "IO::Handle")
| |||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 517 | return; | |||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 15 | ▶ | sub DumpFile { | ||||||||||||||||||||||||||
|
Subroutine
DumpFile: called CC=11 SCAR=25.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 83 | 15 | my $file = shift; | |||||||||||||||||||||||||||
| 84 | 15 | ▶ | if ( _is_glob($file) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 85 | 11 | ▶ | if ( tied(*$file) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | # Tied filehandles (IO::String, IO::Scalar, etc.) don't support | ||||||||||||||||||||||||||||
| 87 | # C-level PerlIO_write. Fall back to Perl-level print. | ||||||||||||||||||||||||||||
| 88 | 3 | for (@_) { | |||||||||||||||||||||||||||
| 89 | 3 | ▶ | print $file YAML::Syck::Dump($_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | or die "Error writing to filehandle $file: $!\n"; | ||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | else { | ||||||||||||||||||||||||||||
| 94 | 8 | for (@_) { | |||||||||||||||||||||||||||
| 95 | 8 | my $err = YAML::Syck::DumpYAMLFile( $_, $file ); | |||||||||||||||||||||||||||
| 96 | 8 | ▶ | if ($err) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | 0 | $! = 0 + $err; | |||||||||||||||||||||||||||
| 98 | 0 | die "Error writing to filehandle $file: $!\n"; | |||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | else { | ||||||||||||||||||||||||||||
| 104 | 4 | ▶ | open( my $fh, '>', $file ) or die "Cannot write to $file: $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | 3 | for (@_) { | |||||||||||||||||||||||||||
| 106 | 3 | my $err = YAML::Syck::DumpYAMLFile( $_, $fh ); | |||||||||||||||||||||||||||
| 107 | 3 | ▶ | if ($err) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 108 | 0 | $! = 0 + $err; | |||||||||||||||||||||||||||
| 109 | 0 | die "Error writing to file $file: $!\n"; | |||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | 3 | ▶ | close $fh | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | or die "Error writing to file $file: $!\n"; | ||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | 14 | return 1; | |||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 516 | ▶ | sub LoadFile { | ||||||||||||||||||||||||||
|
Subroutine
LoadFile: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 119 | 516 | my $file = shift; | |||||||||||||||||||||||||||
| 120 | 516 | ▶ | if ( _is_glob($file) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 121 | Load( | ||||||||||||||||||||||||||||
| 122 | 9 | do { local $/; <$file> } | |||||||||||||||||||||||||||
| 123 | ); | ||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | else { | ||||||||||||||||||||||||||||
| 126 | 507 | ▶ | if ( !-e $file || -z $file ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not -e $file or -z $file
MC/DC100%2/2
not -e $file or -z $file
not -e $file
-z $file
Truth table100%3/3
not(A) or B
A= not -e $fileB= -z $file
| |||||||||||||||||||||||||||||
| 127 | 2 | die("'$file' is empty or non-existent"); | |||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | 505 | ▶ | open( my $fh, '<', $file ) or die "Cannot read from $file: $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | Load( | ||||||||||||||||||||||||||||
| 131 | 504 | do { local $/; <$fh> } | |||||||||||||||||||||||||||
| 132 | ); | ||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | 6 | ▶ | sub LoadBytes { | ||||||||||||||||||||||||||
|
Subroutine
LoadBytes: called CC=6 SCAR=18.1
Pod
documented
| |||||||||||||||||||||||||||||
| 137 | 6 | my ($str) = @_; | |||||||||||||||||||||||||||
| 138 | 6 | utf8::downgrade($str); | |||||||||||||||||||||||||||
| 139 | 6 | ▶ | if (wantarray) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | 4 | ▶ | return unless defined $str && length $str; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $str and length $str
MC/DC100%2/2
defined $str and length $str
defined $str
length $str
Truth table100%3/3
A and B
A= defined $strB= length $str
| |||||||||||||||||||||||||||||
| 141 | 2 | my ($rv) = YAML::Syck::LoadYAML($str); | |||||||||||||||||||||||||||
| 142 | 2 | ▶ | return unless defined $rv && ref $rv eq 'ARRAY'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $rv and ref $rv eq "ARRAY"
MC/DC0%0/2
defined $rv and ref $rv eq "ARRAY"
defined $rv
ref $rv eq "ARRAY"
Truth table33%1/3
A and B
A= defined $rvB= ref $rv eq "ARRAY"
| |||||||||||||||||||||||||||||
| 143 | 2 | return @{$rv}; | |||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | 2 | return YAML::Syck::LoadYAML($str); | |||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 6 | ▶ | sub LoadUTF8 { | ||||||||||||||||||||||||||
|
Subroutine
LoadUTF8: called CC=6 SCAR=18.1
Pod
documented
| |||||||||||||||||||||||||||||
| 149 | 6 | my ($str) = @_; | |||||||||||||||||||||||||||
| 150 | 6 | local $YAML::Syck::ImplicitUnicode = 1; | |||||||||||||||||||||||||||
| 151 | 6 | ▶ | if (wantarray) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 152 | 4 | ▶ | return unless defined $str && length $str; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $str and length $str
MC/DC100%2/2
defined $str and length $str
defined $str
length $str
Truth table100%3/3
A and B
A= defined $strB= length $str
| |||||||||||||||||||||||||||||
| 153 | 2 | my ($rv) = YAML::Syck::LoadYAML($str); | |||||||||||||||||||||||||||
| 154 | 2 | ▶ | return unless defined $rv && ref $rv eq 'ARRAY'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $rv and ref $rv eq "ARRAY"
MC/DC0%0/2
defined $rv and ref $rv eq "ARRAY"
defined $rv
ref $rv eq "ARRAY"
Truth table33%1/3
A and B
A= defined $rvB= ref $rv eq "ARRAY"
| |||||||||||||||||||||||||||||
| 155 | 2 | return @{$rv}; | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | 2 | return YAML::Syck::LoadYAML($str); | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 2 | ▶ | sub DumpBytes { | ||||||||||||||||||||||||||
|
Subroutine
DumpBytes: called CC=3 SCAR=12.5
Pod
documented
| |||||||||||||||||||||||||||||
| 161 | my $result = $#_ | ||||||||||||||||||||||||||||
| 162 | 0 | ▶ | ? join( '', map { YAML::Syck::DumpYAML($_) } @_ ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 163 | : YAML::Syck::DumpYAML( $_[0] ); | ||||||||||||||||||||||||||||
| 164 | 2 | ▶ | utf8::encode($result) if utf8::is_utf8($result); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 165 | 2 | return $result; | |||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | 1 | ▶ | sub DumpUTF8 { | ||||||||||||||||||||||||||
|
Subroutine
DumpUTF8: called CC=2 SCAR=8.1
Pod
documented
| |||||||||||||||||||||||||||||
| 169 | 1 | local $YAML::Syck::ImplicitUnicode = 1; | |||||||||||||||||||||||||||
| 170 | $#_ | ||||||||||||||||||||||||||||
| 171 | 0 | ▶ | ? join( '', map { YAML::Syck::DumpYAML($_) } @_ ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 172 | : YAML::Syck::DumpYAML( $_[0] ); | ||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 8 | ▶ | sub DumpInto { | ||||||||||||||||||||||||||
|
Subroutine
DumpInto: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 176 | 8 | my $bufref = shift; | |||||||||||||||||||||||||||
| 177 | 8 | ▶ | ( ref $bufref ) or die "DumpInto not given reference to output buffer\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | 8 | YAML::Syck::DumpYAMLInto( $_, $bufref ) for @_; | |||||||||||||||||||||||||||
| 179 | 8 | 1; | |||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 72 | 1; | |||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | __END__ | ||||||||||||||||||||||||||||