B
benoit Guyon
hello,
i have a problem when reading a tar.Z file :
the code is :
# ----------------------------------------------------
#!/usr/local/bin/perl -w
use strict;
use warnings;
use Archive::Tar;
my $arch_name_tar_Z = 'myfile.tar.Z';
my $tar = Archive::Tar->new;
$tar->read($arch_name_tar_Z, 1)
or die("*** ERROR read Archive::Tar: $!");
# ----------------------------------------------------
and the error is :
Can not read compressed format in tar-mode
i tried the commands :
tar -xzvf myfile.tar.Z -> OK (i get valid files)
uncompress myfile.tar.Z -> OK (i get a valid myfile.tar file)
gunzip myfile.tar.Z -> OK (i get a valid myfile.tar file)
i checked the code in Tar.pm, and found
unless( $read++ ) {
my $gzip = GZIP_MAGIC_NUM;
if( $chunk =~ /$gzip/ ) {
$self->_error( qq[Can not read compressed format in tar-mode] );
return;
}
}
is my archive compressed with an exotic compressor ? why can the batch
tar command successfully do the job ?
does somebody have an idea to help me ?
best regards
benoit
PS : i tried to build a IO::Zlib Handle on the file (success) and then
to pass it to the Archive::Tar->read function, but i get the same error
message.
PS 2 : Archive::Tar->can_handle_compressed_files gives true
i have a problem when reading a tar.Z file :
the code is :
# ----------------------------------------------------
#!/usr/local/bin/perl -w
use strict;
use warnings;
use Archive::Tar;
my $arch_name_tar_Z = 'myfile.tar.Z';
my $tar = Archive::Tar->new;
$tar->read($arch_name_tar_Z, 1)
or die("*** ERROR read Archive::Tar: $!");
# ----------------------------------------------------
and the error is :
Can not read compressed format in tar-mode
i tried the commands :
tar -xzvf myfile.tar.Z -> OK (i get valid files)
uncompress myfile.tar.Z -> OK (i get a valid myfile.tar file)
gunzip myfile.tar.Z -> OK (i get a valid myfile.tar file)
i checked the code in Tar.pm, and found
unless( $read++ ) {
my $gzip = GZIP_MAGIC_NUM;
if( $chunk =~ /$gzip/ ) {
$self->_error( qq[Can not read compressed format in tar-mode] );
return;
}
}
is my archive compressed with an exotic compressor ? why can the batch
tar command successfully do the job ?
does somebody have an idea to help me ?
best regards
benoit
PS : i tried to build a IO::Zlib Handle on the file (success) and then
to pass it to the Archive::Tar->read function, but i get the same error
message.
PS 2 : Archive::Tar->can_handle_compressed_files gives true