File Coverage

blib/lib/Aion/Format/Yaml.pm
Criterion Covered Total %
statement 11 11 100.0
branch 2 4 50.0
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 20 22 90.9


line stmt bran cond sub pod time code
1             package Aion::Format::Yaml;
2              
3 1     1   122779 use common::sense;
  1         2  
  1         5  
4 1     1   458 use YAML::Syck qw//;
  1         1813  
  1         43  
5              
6 1     1   7 use Exporter qw/import/;
  1         1  
  1         249  
7             our @EXPORT = our @EXPORT_OK = grep {
8             *{$Aion::Format::Yaml::{$_}}{CODE} && !/^(_|(NaN|import)\z)/n
9             } keys %Aion::Format::Yaml::;
10              
11             #@category yaml
12              
13             # Настраиваем yaml
14             $YAML::Syck::Headless = 1;
15             $YAML::Syck::SortKeys = 1;
16             $YAML::Syck::ImplicitTyping = 1;
17             $YAML::Syck::ImplicitUnicode = 1;
18             $YAML::Syck::ImplicitBinary = 1;
19             $YAML::Syck::UseCode = 1;
20             $YAML::Syck::LoadCode = 1;
21             $YAML::Syck::DumpCode = 1;
22              
23             # В yaml
24             sub to_yaml(;$) {
25 3 50   3 1 136203 YAML::Syck::Dump(@_ == 0? $_: @_)
26             }
27              
28             # Из yaml
29             sub from_yaml(;$) {
30 9 50   9 1 7691 scalar YAML::Syck::Load(@_ == 0? $_: @_)
31             }
32              
33             1;
34              
35             __END__