« blib/lib/App/RecordStream/Aggregator/Internal/Constant.pm
↑ Summary
blib/lib/App/RecordStream/Accumulator.pm »
| 1 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package App::RecordStream::Operation::tojsonarray; | ||||||||||
| 6 | 1 | ▶ | use base qw(App::RecordStream::Operation); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | sub init { | ||||||||||
| 9 | 2 | ▶ | my $this = shift; | ||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 10 | 2 | my $args = shift; | |||||||||
| 11 | 2 | $this->parse_options($args); | |||||||||
| 12 | 2 | $this->{COUNT} = 0; | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | sub accept_line { | ||||||||||
| 16 | 4 | ▶ | my $this = shift; | ||||||||
|
Subroutine
accept_line: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 17 | 4 | my $line = shift; | |||||||||
| 18 | $this->push_line( | ||||||||||
| 19 | 4 | ▶ | $this->{COUNT}++ == 0 | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | ? "[$line" | ||||||||||
| 21 | : ",$line" | ||||||||||
| 22 | ); | ||||||||||
| 23 | 4 | return 1; | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | sub stream_done { | ||||||||||
| 27 | 2 | ▶ | my $this = shift; | ||||||||
|
Subroutine
stream_done: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 28 | $this->push_line( | ||||||||||
| 29 | $this->{COUNT} | ||||||||||
| 30 | 2 | ▶ | ? "]" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | : "[]" | ||||||||||
| 32 | ); | ||||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | sub usage { | ||||||||||
| 36 | 0 | ▶ | my $this = shift; | ||||||||
|
Subroutine
usage: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 37 | 0 | return <<USAGE; | |||||||||
| 38 | Usage: recs tojsonarray [files] | ||||||||||
| 39 | __FORMAT_TEXT__ | ||||||||||
| 40 | This command outputs the record stream as a single JSON array. It | ||||||||||
| 41 | complements the fromjsonarray command. | ||||||||||
| 42 | __FORMAT_TEXT__ | ||||||||||
| 43 | |||||||||||
| 44 | Examples | ||||||||||
| 45 | # Save the record stream to a file suitable for loading by any JSON parser | ||||||||||
| 46 | ... | recs tojsonarray > recs.json | ||||||||||
| 47 | USAGE | ||||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 1 | 1; | |||||||||