line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Dir::Dumper::Stream::JSON::Reader; |
2
|
|
|
|
|
|
|
$File::Dir::Dumper::Stream::JSON::Reader::VERSION = '0.6.4'; |
3
|
2
|
|
|
2
|
|
107819
|
use warnings; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
67
|
|
4
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
56
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
32
|
use 5.012; |
|
2
|
|
|
|
|
9
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
10
|
use parent 'File::Dir::Dumper::Base'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
20
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
116
|
use Carp (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
38
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
505
|
use JSON::MaybeXS qw(decode_json); |
|
2
|
|
|
|
|
8305
|
|
|
2
|
|
|
|
|
125
|
|
13
|
2
|
|
|
2
|
|
530
|
use Class::XSAccessor accessors => { _in => 'in' }; |
|
2
|
|
|
|
|
2459
|
|
|
2
|
|
|
|
|
14
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _init |
17
|
|
|
|
|
|
|
{ |
18
|
4
|
|
|
4
|
|
26
|
my $self = shift; |
19
|
4
|
|
|
|
|
19
|
my $args = shift; |
20
|
|
|
|
|
|
|
|
21
|
4
|
|
|
|
|
46
|
$self->_in( $args->{input} ); |
22
|
|
|
|
|
|
|
|
23
|
4
|
|
|
|
|
17
|
$self->_init_stream(); |
24
|
|
|
|
|
|
|
|
25
|
4
|
|
|
|
|
11
|
return; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _readline |
29
|
|
|
|
|
|
|
{ |
30
|
18
|
|
|
18
|
|
32
|
my $self = shift; |
31
|
|
|
|
|
|
|
|
32
|
18
|
|
|
|
|
135
|
return readline( $self->_in() ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _eof |
36
|
|
|
|
|
|
|
{ |
37
|
24
|
|
|
24
|
|
52
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
24
|
|
|
|
|
104
|
return eof( $self->_in() ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _init_stream |
43
|
|
|
|
|
|
|
{ |
44
|
4
|
|
|
4
|
|
10
|
my $self = shift; |
45
|
|
|
|
|
|
|
|
46
|
4
|
50
|
|
|
|
29
|
if ( $self->_readline() ne "# JSON Stream by Shlomif - Version 0.2.0\n" ) |
47
|
|
|
|
|
|
|
{ |
48
|
0
|
|
|
|
|
0
|
Carp::confess "No header for JSON stream"; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
4
|
|
|
|
|
102
|
return; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub fetch |
55
|
|
|
|
|
|
|
{ |
56
|
10
|
|
|
10
|
1
|
1055
|
my $self = shift; |
57
|
|
|
|
|
|
|
|
58
|
10
|
|
|
|
|
30
|
my $buffer = ""; |
59
|
10
|
|
|
|
|
17
|
my $line; |
60
|
|
|
|
|
|
|
|
61
|
10
|
100
|
|
|
|
25
|
if ( $self->_eof() ) |
62
|
|
|
|
|
|
|
{ |
63
|
3
|
|
|
|
|
32
|
return; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
LINES: |
67
|
7
|
|
|
|
|
71
|
while ( !$self->_eof() ) |
68
|
|
|
|
|
|
|
{ |
69
|
14
|
|
|
|
|
94
|
$line = $self->_readline(); |
70
|
14
|
100
|
|
|
|
308
|
if ( $line eq "--/f\n" ) |
71
|
|
|
|
|
|
|
{ |
72
|
7
|
|
|
|
|
97
|
return decode_json($buffer); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
else |
75
|
|
|
|
|
|
|
{ |
76
|
7
|
|
|
|
|
23
|
$buffer .= $line; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
0
|
|
|
|
|
|
Carp::confess "Error! Reached end of file without record terminator."; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; # End of File::Dir::Dumper |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__END__ |