Skip to content

Commit e01f409

Browse files
authored
lazy import for compression feature
1 parent ab59fa1 commit e01f409

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bin/tar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ License:
1313

1414
use strict;
1515

16-
use Compress::Zlib qw(gzopen);
1716
use File::Basename qw(basename);
1817
use Getopt::Std;
1918
use IO::File;
@@ -212,7 +211,8 @@ else
212211

213212
if ($opt{'z'} || $opt{'Z'})
214213
{
215-
# quick and dirty till we sort out Compress::Zlib
214+
eval { require Compress::Zlib } or fatal('Compress::Zlib not found');
215+
Compress::Zlib->import;
216216
my $gz = gzopen($fh, 'rb') or fatal("Cannot gzopen: $Compress::Zlib::gzerrno");
217217
$read = sub { $gz->gzread($_[0],$_[1]) < 0 ? $Compress::Zlib::gzerrno : 0 };
218218
}

0 commit comments

Comments
 (0)