YAML/Any.pm

filter: Statementstmt 57.1% 52 / 91 Branchbran 28.5% 4 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 73.6% 14 / 19 Podpod 0.0% 0 / 7 totaltotal 53.4% 70 / 131 CC 13 SCAR 17.5
CC
13
Cov
53%
Dump
12.0
DumpFile
12.0
Load
12.0
CRAP 5.8
↑ Summary YAML.pm »
1 2 ▶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 2 our $VERSION = '1.23_002';
4  
5 2 ▶use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 @YAML::Any::ISA = 'Exporter';
8 2 @YAML::Any::EXPORT = qw(Dump Load);
9 2 @YAML::Any::EXPORT_OK = qw(DumpFile LoadFile);
10  
11 2 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 2 my @load_options = qw(
30 UseCode
31 LoadCode
32 Preserve
33 );
34  
35 2 my @implementations = qw(
36 YAML::XS
37 YAML::Syck
38 YAML::Old
39 YAML::Tiny
40 );
41  
42 sub import {
43 1 ▶ __PACKAGE__->implementation;
Subroutine import: called CC=1 SCAR=0.0
44 1 goto &Exporter::import;
45 }
46  
47 sub Dump {
48 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
49 2 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
50 0 ▶ my $implementation = __PACKAGE__->implementation;
Subroutine Dump: not called CC=3 SCAR=24.8
Pod undocumented
51 0 for my $option (@dump_options) {
52 0 my $var = "$implementation\::$option";
53 0 my $value = $$var;
54 0 local $$var;
55 0 ▶ $$var = defined $value ? $value : ${"YAML::$option"};
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 0 0 0
56 }
57 0 return &{"$implementation\::Dump"}(@_);
58 }
59  
60 sub DumpFile {
61 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
62 2 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
63 0 ▶ my $implementation = __PACKAGE__->implementation;
Subroutine DumpFile: not called CC=3 SCAR=24.8
Pod undocumented
64 0 for my $option (@dump_options) {
65 0 my $var = "$implementation\::$option";
66 0 my $value = $$var;
67 0 local $$var;
68 0 ▶ $$var = defined $value ? $value : ${"YAML::$option"};
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 0 0 0
69 }
70 0 return &{"$implementation\::DumpFile"}(@_);
71 }
72  
73 sub Load {
74 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
75 2 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
76 0 ▶ my $implementation = __PACKAGE__->implementation;
Subroutine Load: not called CC=3 SCAR=24.8
Pod undocumented
77 0 for my $option (@load_options) {
78 0 my $var = "$implementation\::$option";
79 0 my $value = $$var;
80 0 local $$var;
81 0 ▶ $$var = defined $value ? $value : ${"YAML::$option"};
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 0 0 0
82 }
83 0 return &{"$implementation\::Load"}(@_);
84 }
85  
86 sub LoadFile {
87 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
88 2 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
89 0 ▶ my $implementation = __PACKAGE__->implementation;
Subroutine LoadFile: not called CC=3 SCAR=24.8
Pod undocumented
90 0 for my $option (@load_options) {
91 0 my $var = "$implementation\::$option";
92 0 my $value = $$var;
93 0 local $$var;
94 0 ▶ $$var = defined $value ? $value : ${"YAML::$option"};
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 0 0 0
95 }
96 0 return &{"$implementation\::LoadFile"}(@_);
97 }
98  
99 sub order {
100 return @YAML::Any::_TEST_ORDER
101 1 ▶ if @YAML::Any::_TEST_ORDER;
Subroutine order: called CC=2 SCAR=7.2
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if @YAML::Any::_TEST_ORDER 0 1 1
102 1 return @implementations;
103 }
104  
105 sub implementation {
106 1 ▶ my @order = __PACKAGE__->order;
Subroutine implementation: called CC=4 SCAR=14.0
Pod undocumented
107 1 for my $module (@order) {
108 3 my $path = $module;
109 3 $path =~ s/::/\//g;
110 3 $path .= '.pm';
111 3 ▶ return $module if exists $INC{$path};
Branch: 1 branch
BranchTrueFalseTotal
if exists $INC{$path} 0 3 3
112 3 ▶ eval "require $module; 1" and return $module;
Branch: 1 branch
BranchTrueFalseTotal
eval "require $module; 1" and return $module 1 2 3
113 }
114 0 croak("YAML::Any couldn't find any of these YAML implementations: @order");
115 }
116  
117 sub croak {
118 0 ▶ require Carp;
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
119 0 Carp::croak(@_);
120 }
121  
122 2 1;
↑ Summary YAML.pm »