YAML.pm

filter: Statementstmt 87.1% 34 / 39 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 12 / 14 Podpod 0.0% 0 / 9 totaltotal 73.4% 47 / 64 CC 3 SCAR 4.3
CC
3
Cov
85%
import
3.2
yaml
2.0
Blessed
2.0
CRAP 1.5
« YAML/Any.pm ↑ Summary YAML/API.pm »
1 package YAML;
2 39 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 39 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 39 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
6 39 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 39 our @EXPORT = qw( Load Dump );
8 39 our @EXPORT_OK = qw( LoadFile DumpFile freeze thaw yaml );
9  
10 39 our $VERSION = '1.23_002';
11  
12 sub import {
13 14 ▶ my ($package, @args) = @_;
Subroutine import: called CC=3 SCAR=11.7
14  
15 14 for my $arg (@args) {
16 12 ▶ if ($arg !~ /^(Load|LoadFile|Dump|DumpFile|freeze|thaw|Bless|Blessed|yaml)$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($arg =~ /^(Load|LoadFile|Dump|DumpFile|freeze|thaw|Bless|Blessed|yaml)$/) 0 12 12
17 # Handle new API; return;
18 0 croak "Cannot export '$arg'\n";
19 }
20 }
21 14 YAML->export_to_level(1, $package, @args);
22 }
23  
24 sub yaml {
25 0 ▶ require YAML::API;
Subroutine yaml: not called CC=1 SCAR=6.9
Pod undocumented
26 0 return YAML::API->new(@_);
27 }
28  
29 sub Load {
30 232 ▶ require YAML::Old;
Subroutine Load: called CC=1 SCAR=0.0
Pod undocumented
31 232 goto &YAML::Old::Load;
32 }
33  
34 sub Dump {
35 119 ▶ require YAML::Old;
Subroutine Dump: called CC=1 SCAR=0.0
Pod undocumented
36 119 goto &YAML::Old::Dump;
37 }
38  
39 sub LoadFile {
40 4 ▶ require YAML::Old;
Subroutine LoadFile: called CC=1 SCAR=0.0
Pod undocumented
41 4 goto &YAML::Old::LoadFile;
42 }
43  
44 sub DumpFile {
45 4 ▶ require YAML::Old;
Subroutine DumpFile: called CC=1 SCAR=0.0
Pod undocumented
46 4 goto &YAML::Old::DumpFile;
47 }
48  
49 sub thaw {
50 1 ▶ require YAML::Old;
Subroutine thaw: called CC=1 SCAR=0.0
Pod undocumented
51 1 goto &YAML::Old::thaw;
52 }
53  
54 sub freeze {
55 1 ▶ require YAML::Old;
Subroutine freeze: called CC=1 SCAR=0.0
Pod undocumented
56 1 goto &YAML::Old::freeze;
57 }
58  
59 sub Bless {
60 1 ▶ require YAML::Old;
Subroutine Bless: called CC=1 SCAR=0.0
Pod undocumented
61 1 goto &YAML::Old::Bless;
62 }
63  
64 sub Blessed {
65 0 ▶ require YAML::Old;
Subroutine Blessed: not called CC=1 SCAR=6.9
Pod undocumented
66 0 goto &YAML::Old::Blessed;
67 }
68  
69 39 1;
70  
71 =pod
72  
73 =encoding utf-8
74  
75 =head1 NAME
76  
77 YAML - YAML Ain't Markup Language™
78  
79 =head1 STATUS
80  
81 L<YAML> is undergoing changes that will make it the future gateway to almost
82 all (new and old) YAML functionality, while at the same time working almost
83 exactly the same for existing code.
84  
85 See
86 L<https://github.com/ingydotnet/yaml-old-pm/blob/master/doc/yaml-old-transition.md#yaml-to-yamlold-transition>
87 for details.
88  
89 The "New usage" shown below is B<very> new and subject to change.
90  
91 =head1 SYNOPSIS
92  
93 Old usage:
94  
95 use YAML;
96  
97 my $yaml = "foo: 42\n";
98 my $hash = Load $yaml;
99 $hash->{bar} = 44;
100 $yaml = Dump $hash;
101  
102 New usage:
103  
104 use YAML 'yaml';
105  
106 my $hash = yaml->load($yaml);
107 $hash->{bar} = 44;
108 $yaml = yaml->dump($hash);
109  
110 ...much more coming soon...
111  
112 =head1 DESCRIPTION
113  
114 YAML is a human friendly data serialization language with implementations in
115 many programming languages.
116  
117 YAML.pm is Perl 5's first YAML module. Written in 2001, that code has been
118 moved to L<YAML::Old> an L<YAML> is now the API frontend to various YAML
119 backends.
120  
121 NOTE: This is a current WIP and more doc will follow as things develop.
122  
123 =head1 AUTHORS
124  
125 =over
126  
127 =item Ingy döt Net <ingy@cpan.org>
128  
129 =item Tina Müller <cpan2@tinita.de>
130  
131 =back
132  
133 =head1 COPYRIGHT AND LICENSE
134  
135 Copyright 2001-2017. Ingy döt Net.
136  
137 This program is free software; you can redistribute it and/or modify it under
138 the same terms as Perl itself.
139  
140 See L<http://www.perl.com/perl/misc/Artistic.html>
141  
142 =cut
« YAML/Any.pm ↑ Summary YAML/API.pm »