| 1 | package Log::Saftpresse::CountersOutput::JSON; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | # ABSTRACT: plugin to dump counters in JSON format | ||
| 7 | 1 | our $VERSION = '1.5'; # VERSION | |
| 8 | |||
| 9 | 1 | ▶ | use base 'Log::Saftpresse::CountersOutput'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 1 | ▶ | use JSON; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | sub output { | ||
| 14 | 0 | ▶ | my ( $self, $counters ) = @_; |
|
Subroutine
output: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 15 | 0 | my $json = JSON->new; | |
| 16 | 0 | $json->pretty(1); | |
| 17 | my %data = map { | ||
| 18 | 0 | $_ => $counters->{$_}->counters, | |
| 19 | } keys %$counters; | ||
| 20 | 0 | print $json->encode( \%data ); | |
| 21 | 0 | return; | |
| 22 | } | ||
| 23 | |||
| 24 | 1 | 1; | |
| 25 | |||
| 26 | __END__ | ||
| 27 | |||
| 28 | =pod | ||
| 29 | |||
| 30 | =encoding UTF-8 | ||
| 31 | |||
| 32 | =head1 NAME | ||
| 33 | |||
| 34 | Log::Saftpresse::CountersOutput::JSON - plugin to dump counters in JSON format | ||
| 35 | |||
| 36 | =head1 VERSION | ||
| 37 | |||
| 38 | version 1.5 | ||
| 39 | |||
| 40 | =head1 AUTHOR | ||
| 41 | |||
| 42 | Markus Benning <ich@markusbenning.de> | ||
| 43 | |||
| 44 | =head1 COPYRIGHT AND LICENSE | ||
| 45 | |||
| 46 | This software is Copyright (c) 1998 by James S. Seymour, 2015 by Markus Benning. | ||
| 47 | |||
| 48 | This is free software, licensed under: | ||
| 49 | |||
| 50 | The GNU General Public License, Version 2, June 1991 | ||
| 51 | |||
| 52 | =cut | ||