| 1 | package Net::Lumberjack::Frame::Compressed; | ||
| 2 | |||
| 3 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | # ABSTRACT: class for parsing Lumberjack compressed frames | ||
| 6 | 1 | our $VERSION = '1.01'; # VERSION | |
| 7 | |||
| 8 | 1 | extends 'Net::Lumberjack::Frame'; | |
| 9 | |||
| 10 | 1 | ▶ | use Compress::Zlib; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 1 | has 'type' => ( is => 'rw', isa => 'Str', default => 'C' ); | |
| 13 | 1 | has 'stream' => ( is => 'rw', isa => 'Maybe[Str]' ); | |
| 14 | |||
| 15 | has 'payload' => ( | ||
| 16 | is => 'rw', isa => 'Str', lazy => 1, | ||
| 17 | 'default' => sub { | ||
| 18 | 0 | ▶ | my $self = shift; |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 19 | 0 | my $compressed = compress( $self->stream ); | |
| 20 | 0 | my $len = length($compressed); | |
| 21 | 0 | return pack('N', $len).$compressed; | |
| 22 | }, | ||
| 23 | 1 | ); | |
| 24 | |||
| 25 | sub _read_payload { | ||
| 26 | 0 | ▶ | my ( $self, $fh ) = @_; |
|
Subroutine
_read_payload: not called CC=1 SCAR=6.9
| |||
| 27 | 0 | $self->stream( uncompress $self->_read_data($fh) ); | |
| 28 | 0 | return; | |
| 29 | } | ||
| 30 | |||
| 31 | 1 | 1; | |
| 32 | |||
| 33 | __END__ | ||
| 34 | |||
| 35 | =pod | ||
| 36 | |||
| 37 | =encoding UTF-8 | ||
| 38 | |||
| 39 | =head1 NAME | ||
| 40 | |||
| 41 | Net::Lumberjack::Frame::Compressed - class for parsing Lumberjack compressed frames | ||
| 42 | |||
| 43 | =head1 VERSION | ||
| 44 | |||
| 45 | version 1.01 | ||
| 46 | |||
| 47 | =head1 AUTHOR | ||
| 48 | |||
| 49 | Markus Benning <ich@markusbenning.de> | ||
| 50 | |||
| 51 | =head1 COPYRIGHT AND LICENSE | ||
| 52 | |||
| 53 | This software is Copyright (c) 2016 by Markus Benning. | ||
| 54 | |||
| 55 | This is free software, licensed under: | ||
| 56 | |||
| 57 | The Apache License, Version 2.0, January 2004 | ||
| 58 | |||
| 59 | =cut | ||