line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# pyyaml/lib/yaml/dumper.py |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package YAML::Perl::Dumper; |
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
4309
|
use strict; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
220
|
|
6
|
5
|
|
|
5
|
|
29
|
use warnings; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
208
|
|
7
|
5
|
|
|
5
|
|
1938
|
use YAML::Perl::Processor -base; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
58
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
field 'next_layer' => 'representer'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# These fields are chained together such that you can access any lower |
12
|
|
|
|
|
|
|
# level from any higher level. |
13
|
|
|
|
|
|
|
field 'representer', -chain, -init => '$self->create("representer")'; |
14
|
|
|
|
|
|
|
field 'serializer', -chain, -init => '$self->representer->serializer'; |
15
|
|
|
|
|
|
|
field 'emitter', -chain, -init => '$self->serializer->emitter'; |
16
|
|
|
|
|
|
|
# field 'painter', -chain, -init => '$self->emitter->painter'; |
17
|
|
|
|
|
|
|
field 'writer', -chain, -init => '$self->emitter->writer'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Setting a class name from the loader will set it in the appropriate |
20
|
|
|
|
|
|
|
# class. When setting class names it is important to set the higher |
21
|
|
|
|
|
|
|
# level ones first since accessing a lower level one will instantiate |
22
|
|
|
|
|
|
|
# any higher level objects with their default class names. |
23
|
|
|
|
|
|
|
field 'representer_class', -chain => -init => '"YAML::Perl::Representer"'; |
24
|
|
|
|
|
|
|
field 'serializer_class', -chain => -onset => '$self->representer->serializer_class($_)'; |
25
|
|
|
|
|
|
|
field 'emitter_class', -chain => -onset => '$self->serializer->emitter_class($_)'; |
26
|
|
|
|
|
|
|
# field 'painter_class', -chain => -onset => '$self->emitter->painter_class($_)'; |
27
|
|
|
|
|
|
|
field 'writer_class', -chain => -onset => '$self->emitter->writer_class($_)'; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub dump { |
30
|
12
|
|
|
12
|
0
|
30
|
my $self = shift; |
31
|
12
|
|
|
|
|
38
|
for (@_) { |
32
|
12
|
|
|
|
|
303
|
$self->representer->represent_document($_); |
33
|
|
|
|
|
|
|
} |
34
|
12
|
|
|
|
|
67
|
return $self->stream(); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub stream { |
38
|
18
|
|
|
18
|
0
|
36
|
my $self = shift; |
39
|
18
|
|
|
|
|
23
|
return ${$self->representer->serializer->emitter->writer->stream->buffer}; |
|
18
|
|
|
|
|
461
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |