| 1 | 1 | ▶ | use strict; use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | package YAML::Any; | ||||||||||
| 3 | 1 | our $VERSION = '1.321'; | |||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Exporter (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | @YAML::Any::ISA = 'Exporter'; | |||||||||
| 8 | 1 | @YAML::Any::EXPORT = qw(Dump Load); | |||||||||
| 9 | 1 | @YAML::Any::EXPORT_OK = qw(DumpFile LoadFile); | |||||||||
| 10 | |||||||||||
| 11 | 1 | my @dump_options = qw( | |||||||||
| 12 | UseCode | ||||||||||
| 13 | DumpCode | ||||||||||
| 14 | SpecVersion | ||||||||||
| 15 | Indent | ||||||||||
| 16 | UseHeader | ||||||||||
| 17 | UseVersion | ||||||||||
| 18 | SortKeys | ||||||||||
| 19 | AnchorPrefix | ||||||||||
| 20 | UseBlock | ||||||||||
| 21 | UseFold | ||||||||||
| 22 | CompressSeries | ||||||||||
| 23 | InlineSeries | ||||||||||
| 24 | UseAliases | ||||||||||
| 25 | Purity | ||||||||||
| 26 | Stringify | ||||||||||
| 27 | ); | ||||||||||
| 28 | |||||||||||
| 29 | 1 | my @load_options = qw( | |||||||||
| 30 | UseCode | ||||||||||
| 31 | LoadCode | ||||||||||
| 32 | Preserve | ||||||||||
| 33 | ); | ||||||||||
| 34 | |||||||||||
| 35 | 1 | my @implementations = qw( | |||||||||
| 36 | YAML::XS | ||||||||||
| 37 | YAML::Syck | ||||||||||
| 38 | YAML::Old | ||||||||||
| 39 | YAML | ||||||||||
| 40 | YAML::Tiny | ||||||||||
| 41 | ); | ||||||||||
| 42 | |||||||||||
| 43 | 1 | ▶ | sub import { | ||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||
| 44 | 1 | __PACKAGE__->implementation; | |||||||||
| 45 | 1 | goto &Exporter::import; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | sub Dump { | ||||||||
|
Subroutine
Dump: not called CC=3 SCAR=16.9
Pod
documented
| |||||||||||
| 49 | 1 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 50 | 1 | ▶ | no warnings 'once'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 51 | 0 | my $implementation = __PACKAGE__->implementation; | |||||||||
| 52 | 0 | for my $option (@dump_options) { | |||||||||
| 53 | 0 | my $var = "$implementation\::$option"; | |||||||||
| 54 | 0 | my $value = $$var; | |||||||||
| 55 | 0 | local $$var; | |||||||||
| 56 | 0 | ▶ | $$var = defined $value ? $value : ${"YAML::$option"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 57 | } | ||||||||||
| 58 | 0 | return &{"$implementation\::Dump"}(@_); | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 0 | ▶ | sub DumpFile { | ||||||||
|
Subroutine
DumpFile: not called CC=3 SCAR=16.9
Pod
documented
| |||||||||||
| 62 | 1 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 63 | 1 | ▶ | no warnings 'once'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 64 | 0 | my $implementation = __PACKAGE__->implementation; | |||||||||
| 65 | 0 | for my $option (@dump_options) { | |||||||||
| 66 | 0 | my $var = "$implementation\::$option"; | |||||||||
| 67 | 0 | my $value = $$var; | |||||||||
| 68 | 0 | local $$var; | |||||||||
| 69 | 0 | ▶ | $$var = defined $value ? $value : ${"YAML::$option"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 70 | } | ||||||||||
| 71 | 0 | return &{"$implementation\::DumpFile"}(@_); | |||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | 0 | ▶ | sub Load { | ||||||||
|
Subroutine
Load: not called CC=3 SCAR=16.9
Pod
documented
| |||||||||||
| 75 | 1 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 76 | 1 | ▶ | no warnings 'once'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 77 | 0 | my $implementation = __PACKAGE__->implementation; | |||||||||
| 78 | 0 | for my $option (@load_options) { | |||||||||
| 79 | 0 | my $var = "$implementation\::$option"; | |||||||||
| 80 | 0 | my $value = $$var; | |||||||||
| 81 | 0 | local $$var; | |||||||||
| 82 | 0 | ▶ | $$var = defined $value ? $value : ${"YAML::$option"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 83 | } | ||||||||||
| 84 | 0 | return &{"$implementation\::Load"}(@_); | |||||||||
| 85 | } | ||||||||||
| 86 | |||||||||||
| 87 | 0 | ▶ | sub LoadFile { | ||||||||
|
Subroutine
LoadFile: not called CC=3 SCAR=16.9
Pod
documented
| |||||||||||
| 88 | 1 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 89 | 1 | ▶ | no warnings 'once'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 90 | 0 | my $implementation = __PACKAGE__->implementation; | |||||||||
| 91 | 0 | for my $option (@load_options) { | |||||||||
| 92 | 0 | my $var = "$implementation\::$option"; | |||||||||
| 93 | 0 | my $value = $$var; | |||||||||
| 94 | 0 | local $$var; | |||||||||
| 95 | 0 | ▶ | $$var = defined $value ? $value : ${"YAML::$option"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 96 | } | ||||||||||
| 97 | 0 | return &{"$implementation\::LoadFile"}(@_); | |||||||||
| 98 | } | ||||||||||
| 99 | |||||||||||
| 100 | 1 | ▶ | sub order { | ||||||||
|
Subroutine
order: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||
| 101 | return @YAML::Any::_TEST_ORDER | ||||||||||
| 102 | 1 | ▶ | if @YAML::Any::_TEST_ORDER; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 103 | 1 | return @implementations; | |||||||||
| 104 | } | ||||||||||
| 105 | |||||||||||
| 106 | 1 | ▶ | sub implementation { | ||||||||
|
Subroutine
implementation: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||
| 107 | 1 | my @order = __PACKAGE__->order; | |||||||||
| 108 | 1 | for my $module (@order) { | |||||||||
| 109 | 4 | my $path = $module; | |||||||||
| 110 | 4 | $path =~ s/::/\//g; | |||||||||
| 111 | 4 | $path .= '.pm'; | |||||||||
| 112 | 4 | ▶ | return $module if exists $INC{$path}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 113 | 3 | ▶ | eval "require $module; 1" and return $module; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 114 | } | ||||||||||
| 115 | 0 | croak("YAML::Any couldn't find any of these YAML implementations: @order"); | |||||||||
| 116 | } | ||||||||||
| 117 | |||||||||||
| 118 | 0 | ▶ | sub croak { | ||||||||
|
Subroutine
croak: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 119 | 0 | require Carp; | |||||||||
| 120 | 0 | Carp::croak(@_); | |||||||||
| 121 | } | ||||||||||
| 122 | |||||||||||
| 123 | 1 | 1; | |||||||||