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