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 85.7% 6 / 7 totaltotal 58.0% 76 / 131 SCAR 34.1
CC
13
Cov
53%
Dump
12.0
DumpFile
12.0
Load
12.0
CRAP 30.2
« YAML/Types.pm ↑ Summary YAML/Dumper/Base.pm »
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.30';
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 sub import {
44 1 ▶ __PACKAGE__->implementation;
Subroutine import: called CC=1 SCAR=0.0
45 1 goto &Exporter::import;
46 }
47  
48 sub Dump {
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;
Subroutine Dump: not called CC=3 SCAR=24.8
Pod documented
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
BranchTrueFalseTotal
defined $value ? : 0 0 0
57 }
58 0 return &{"$implementation\::Dump"}(@_);
59 }
60  
61 sub DumpFile {
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;
Subroutine DumpFile: not called CC=3 SCAR=24.8
Pod documented
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
BranchTrueFalseTotal
defined $value ? : 0 0 0
70 }
71 0 return &{"$implementation\::DumpFile"}(@_);
72 }
73  
74 sub Load {
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;
Subroutine Load: not called CC=3 SCAR=24.8
Pod documented
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
BranchTrueFalseTotal
defined $value ? : 0 0 0
83 }
84 0 return &{"$implementation\::Load"}(@_);
85 }
86  
87 sub LoadFile {
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;
Subroutine LoadFile: not called CC=3 SCAR=24.8
Pod documented
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
BranchTrueFalseTotal
defined $value ? : 0 0 0
96 }
97 0 return &{"$implementation\::LoadFile"}(@_);
98 }
99  
100 sub order {
101 return @YAML::Any::_TEST_ORDER
102 1 ▶ if @YAML::Any::_TEST_ORDER;
Subroutine order: called CC=2 SCAR=7.2
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @YAML::Any::_TEST_ORDER 0 1 1
103 1 return @implementations;
104 }
105  
106 sub implementation {
107 1 ▶ my @order = __PACKAGE__->order;
Subroutine implementation: called CC=4 SCAR=14.0
Pod documented
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
BranchTrueFalseTotal
if exists $INC{$path} 1 3 4
113 3 ▶ eval "require $module; 1" and return $module;
Branch: 1 branch
BranchTrueFalseTotal
eval "require $module; 1" and return $module 0 3 3
114 }
115 0 croak("YAML::Any couldn't find any of these YAML implementations: @order");
116 }
117  
118 sub croak {
119 0 ▶ require Carp;
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
120 0 Carp::croak(@_);
121 }
122  
123 1 1;
« YAML/Types.pm ↑ Summary YAML/Dumper/Base.pm »