| 1 | package eris::role::decoder; | ||
| 2 | # ABSTRACT: Role for implementing decoders | ||
| 3 | |||
| 4 | 3 | ▶ | use Moo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 3 | ▶ | use Types::Standard qw( Str Int ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 3 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 3 | our $VERSION = '0.008'; # VERSION | |
| 9 | |||
| 10 | |||
| 11 | 3 | requires 'decode_message'; | |
| 12 | 3 | with qw( | |
| 13 | eris::role::plugin | ||
| 14 | ); | ||
| 15 | |||
| 16 | |||
| 17 | 3 | 1; | |
| 18 | |||
| 19 | __END__ | ||
| 20 | |||
| 21 | =pod | ||
| 22 | |||
| 23 | =encoding UTF-8 | ||
| 24 | |||
| 25 | =head1 NAME | ||
| 26 | |||
| 27 | eris::role::decoder - Role for implementing decoders | ||
| 28 | |||
| 29 | =head1 VERSION | ||
| 30 | |||
| 31 | version 0.008 | ||
| 32 | |||
| 33 | =head1 SYNOPSIS | ||
| 34 | |||
| 35 | Implement your own decoders, e.g.: | ||
| 36 | |||
| 37 | use Parse::Syslog::Line; | ||
| 38 | use Moo; | ||
| 39 | with qw( eris::role::decoder ); | ||
| 40 | |||
| 41 | sub decode_message { | ||
| 42 | my ($self,$msg) = @_; | ||
| 43 | return parse_syslog_line($msg); | ||
| 44 | } | ||
| 45 | |||
| 46 | =head1 INTERFACE | ||
| 47 | |||
| 48 | =head2 decode_message | ||
| 49 | |||
| 50 | Passed the raw message as received. Expects a parsed structure in the form of a | ||
| 51 | C<HashRef> as a return. | ||
| 52 | |||
| 53 | =head1 SEE ALSO | ||
| 54 | |||
| 55 | L<eris::log::decoders>, L<eris::log::contextualizer>, L<eris::log::decoders::syslog>, | ||
| 56 | L<eris::log::decoder::json> | ||
| 57 | |||
| 58 | =head1 AUTHOR | ||
| 59 | |||
| 60 | Brad Lhotsky <brad@divisionbyzero.net> | ||
| 61 | |||
| 62 | =head1 COPYRIGHT AND LICENSE | ||
| 63 | |||
| 64 | This software is Copyright (c) 2015 by Brad Lhotsky. | ||
| 65 | |||
| 66 | This is free software, licensed under: | ||
| 67 | |||
| 68 | The (three-clause) BSD License | ||
| 69 | |||
| 70 | =cut | ||