Filename | /usr/share/perl5/YAML.pm |
Statements | Executed 23 statements in 2.05ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 2.31ms | 12.5ms | BEGIN@4 | YAML::
1 | 1 | 1 | 1.80ms | 2.75ms | BEGIN@11 | YAML::
1 | 1 | 1 | 10µs | 26µs | BEGIN@6 | YAML::
1 | 1 | 1 | 9µs | 50µs | BEGIN@14 | YAML::
1 | 1 | 1 | 9µs | 24µs | BEGIN@37 | YAML::
0 | 0 | 0 | 0s | 0s | Bless | YAML::
0 | 0 | 0 | 0s | 0s | Blessed | YAML::
0 | 0 | 0 | 0s | 0s | Dump | YAML::
0 | 0 | 0 | 0s | 0s | DumpFile | YAML::
0 | 0 | 0 | 0s | 0s | Load | YAML::
0 | 0 | 0 | 0s | 0s | LoadFile | YAML::
0 | 0 | 0 | 0s | 0s | __ANON__[:17] | YAML::
0 | 0 | 0 | 0s | 0s | __ANON__[:18] | YAML::
0 | 0 | 0 | 0s | 0s | __ANON__[:19] | YAML::
0 | 0 | 0 | 0s | 0s | __ANON__[:20] | YAML::
0 | 0 | 0 | 0s | 0s | global_object | YAML::
0 | 0 | 0 | 0s | 0s | init_action_object | YAML::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package YAML; | ||||
2 | 1 | 400ns | our $VERSION = '1.13'; | ||
3 | |||||
4 | 2 | 670µs | 2 | 12.5ms | # spent 12.5ms (2.31+10.2) within YAML::BEGIN@4 which was called:
# once (2.31ms+10.2ms) by C4::Items::BEGIN@33 at line 4 # spent 12.5ms making 1 call to YAML::BEGIN@4
# spent 14µs making 1 call to YAML::Mo::__ANON__[YAML/Mo.pm:5] |
5 | |||||
6 | 2 | 54µs | 2 | 42µs | # spent 26µs (10+16) within YAML::BEGIN@6 which was called:
# once (10µs+16µs) by C4::Items::BEGIN@33 at line 6 # spent 26µs making 1 call to YAML::BEGIN@6
# spent 16µs making 1 call to Exporter::import |
7 | 1 | 15µs | push @YAML::ISA, 'Exporter'; | ||
8 | 1 | 700ns | our @EXPORT = qw{ Dump Load }; | ||
9 | 1 | 600ns | our @EXPORT_OK = qw{ freeze thaw DumpFile LoadFile Bless Blessed }; | ||
10 | |||||
11 | 2 | 769µs | 2 | 2.78ms | # spent 2.75ms (1.80+952µs) within YAML::BEGIN@11 which was called:
# once (1.80ms+952µs) by C4::Items::BEGIN@33 at line 11 # spent 2.75ms making 1 call to YAML::BEGIN@11
# spent 23µs making 1 call to Exporter::import |
12 | |||||
13 | # XXX This VALUE nonsense needs to go. | ||||
14 | 2 | 170µs | 2 | 92µs | # spent 50µs (9+42) within YAML::BEGIN@14 which was called:
# once (9µs+42µs) by C4::Items::BEGIN@33 at line 14 # spent 50µs making 1 call to YAML::BEGIN@14
# spent 42µs making 1 call to constant::import |
15 | |||||
16 | # YAML Object Properties | ||||
17 | 1 | 3µs | 1 | 27µs | has dumper_class => default => sub {'YAML::Dumper'}; # spent 27µs making 1 call to YAML::Mo::__ANON__[YAML/Mo.pm:5] |
18 | 1 | 2µs | 1 | 16µs | has loader_class => default => sub {'YAML::Loader'}; # spent 16µs making 1 call to YAML::Mo::__ANON__[YAML/Mo.pm:5] |
19 | 1 | 2µs | 1 | 13µs | has dumper_object => default => sub {$_[0]->init_action_object("dumper")}; # spent 13µs making 1 call to YAML::Mo::__ANON__[YAML/Mo.pm:5] |
20 | 1 | 2µs | 1 | 17µs | has loader_object => default => sub {$_[0]->init_action_object("loader")}; # spent 17µs making 1 call to YAML::Mo::__ANON__[YAML/Mo.pm:5] |
21 | |||||
22 | sub Dump { | ||||
23 | my $yaml = YAML->new; | ||||
24 | $yaml->dumper_class($YAML::DumperClass) | ||||
25 | if $YAML::DumperClass; | ||||
26 | return $yaml->dumper_object->dump(@_); | ||||
27 | } | ||||
28 | |||||
29 | sub Load { | ||||
30 | my $yaml = YAML->new; | ||||
31 | $yaml->loader_class($YAML::LoaderClass) | ||||
32 | if $YAML::LoaderClass; | ||||
33 | return $yaml->loader_object->load(@_); | ||||
34 | } | ||||
35 | |||||
36 | { | ||||
37 | 3 | 352µs | 2 | 39µs | # spent 24µs (9+15) within YAML::BEGIN@37 which was called:
# once (9µs+15µs) by C4::Items::BEGIN@33 at line 37 # spent 24µs making 1 call to YAML::BEGIN@37
# spent 15µs making 1 call to warnings::unimport |
38 | # freeze/thaw is the API for Storable string serialization. Some | ||||
39 | # modules make use of serializing packages on if they use freeze/thaw. | ||||
40 | 1 | 600ns | *freeze = \ &Dump; | ||
41 | 1 | 400ns | *thaw = \ &Load; | ||
42 | } | ||||
43 | |||||
44 | sub DumpFile { | ||||
45 | my $OUT; | ||||
46 | my $filename = shift; | ||||
47 | if (ref $filename eq 'GLOB') { | ||||
48 | $OUT = $filename; | ||||
49 | } | ||||
50 | else { | ||||
51 | my $mode = '>'; | ||||
52 | if ($filename =~ /^\s*(>{1,2})\s*(.*)$/) { | ||||
53 | ($mode, $filename) = ($1, $2); | ||||
54 | } | ||||
55 | open $OUT, $mode, $filename | ||||
56 | or YAML::Mo::Object->die('YAML_DUMP_ERR_FILE_OUTPUT', $filename, $!); | ||||
57 | } | ||||
58 | binmode $OUT, ':utf8'; # if $Config{useperlio} eq 'define'; | ||||
59 | local $/ = "\n"; # reset special to "sane" | ||||
60 | print $OUT Dump(@_); | ||||
61 | } | ||||
62 | |||||
63 | sub LoadFile { | ||||
64 | my $IN; | ||||
65 | my $filename = shift; | ||||
66 | if (ref $filename eq 'GLOB') { | ||||
67 | $IN = $filename; | ||||
68 | } | ||||
69 | else { | ||||
70 | open $IN, '<', $filename | ||||
71 | or YAML::Mo::Object->die('YAML_LOAD_ERR_FILE_INPUT', $filename, $!); | ||||
72 | } | ||||
73 | binmode $IN, ':utf8'; # if $Config{useperlio} eq 'define'; | ||||
74 | return Load(do { local $/; <$IN> }); | ||||
75 | } | ||||
76 | |||||
77 | sub init_action_object { | ||||
78 | my $self = shift; | ||||
79 | my $object_class = (shift) . '_class'; | ||||
80 | my $module_name = $self->$object_class; | ||||
81 | eval "require $module_name"; | ||||
82 | $self->die("Error in require $module_name - $@") | ||||
83 | if $@ and "$@" !~ /Can't locate/; | ||||
84 | my $object = $self->$object_class->new; | ||||
85 | $object->set_global_options; | ||||
86 | return $object; | ||||
87 | } | ||||
88 | |||||
89 | 1 | 300ns | my $global = {}; | ||
90 | sub Bless { | ||||
91 | require YAML::Dumper::Base; | ||||
92 | YAML::Dumper::Base::bless($global, @_) | ||||
93 | } | ||||
94 | sub Blessed { | ||||
95 | require YAML::Dumper::Base; | ||||
96 | YAML::Dumper::Base::blessed($global, @_) | ||||
97 | } | ||||
98 | sub global_object { $global } | ||||
99 | |||||
100 | 1 | 6µs | 1; |