ApacheLog-Compressor
view release on metacpan or search on metacpan
examples/expand.pl view on Meta::CPAN
die "No input file provided" unless defined $in && length $in;
die "No output file provided" unless defined $out && length $out;
binmode STDOUT, ':encoding(utf8)';
binmode STDERR, ':encoding(utf8)';
# Write all data to plain text file
open my $out_fh, '>', $out or die "Failed to create output file $out - $!";
binmode $out_fh, ':encoding(utf8)';
use Data::Dumper;
# Provide a callback to send data through to the file
my $alc = ApacheLog::Compressor->new(
on_log_line => sub {
my ($self, $data) = @_;
# Use the helper method to expand back to plain text representation
print { $out_fh } $self->data_to_text($data) . "\n";
},
);
# Input file - normally use whichever one's just been closed + rotated
( run in 0.236 second using v1.01-cache-2.11-cpan-4d50c553e7e )