X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FSlob.pm;h=9e7c5a119013345c73fdc3c944b00257af65081e;hb=ec907799c39caa310fcaf9db18e00d8a988fad60;hp=33516bd2e83f2afe105771ed779f6bb73e618f5d;hpb=35224ef9dda3fa2cd01de24ffebe0d850a9cab79;p=slob.git diff --git a/lib/Slob.pm b/lib/Slob.pm index 33516bd..9e7c5a1 100644 --- a/lib/Slob.pm +++ b/lib/Slob.pm @@ -3,7 +3,7 @@ package Slob; use 5.014000; use strict; use warnings; -our $VERSION = '0.002'; +our $VERSION = '0.002_001'; use constant MAGIC => "!-1SLOB\x1F"; @@ -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 {