From c4911b1f4d6c1e4b2a3c7f5a71a538b459bbe322 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 13 Jan 2018 21:52:56 +0200 Subject: [PATCH] Add debugging output --- lib/Slob.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/Slob.pm b/lib/Slob.pm index 33516bd..9d78249 100644 --- a/lib/Slob.pm +++ b/lib/Slob.pm @@ -14,6 +14,9 @@ use Compress::Raw::Bzip2; use Compress::Raw::Lzma; use Compress::Raw::Zlib; +# MD5 only used for debugging output in tests +use Digest::MD5 qw/md5_hex/; + our %UNCOMPRESS = ( '' => sub { $_[0] }, 'lzma2' => sub { @@ -156,8 +159,14 @@ sub ftell { } sub uncompress { - my ($self, $data) = @_; - $UNCOMPRESS{$self->{header}{compression}}->($data) + my ($self, $data) = @_; + my $compression = $self->{header}{compression}; + if ($ENV{HARNESS_ACTIVE} && $compression eq 'lzma2') { + my $prefix = unpack 'H*', substr $data, 0, 10; + my $md5sum = md5_hex $data; + Test::More::diag "Uncompressing data starting '$prefix', md5sum $md5sum"; + } + $UNCOMPRESS{$compression}->($data) } sub read_header { -- 2.39.2