Re: How to read .gz members in .tar file

2009-09-10 Thread Claus Kick
2009/9/10 田口 浩 h-tagu...@secom.co.jp

 Hello,

 Anyone knows the way to read .gz members in .tar file?
 I can read plain text files by the next code.
 But when the member is .gz, I get uneadbale binay data.

 use Archive::Tar;
 my $file = shift;
 my $tar = Archive::Tar-new($file, 1) or die Error Archive::Tar, :$!;
 my @files = $tar-list_files;
 for my $file (@files) {
my $filedata = $tar-get_content($file);
print $file:\n, $filedata, \n;
 }

 __END__




Hello,

you should unzip the gz files, with something like that:

(certainly no reference implementation)

use Archive::Zip;

sub unzip_file
{
my $file = shift;
my $zip = Archive::Zip-new($file);
my @members = $zip-memberNames();
#print Dumper \...@members;
#chdir($zip_directory);
foreach (@members)
{
$zip-extractMemberWithoutPaths($_ );
}
#chdir($start_dir);
}
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: How to read .gz members in .tar file

2009-09-10 Thread 田口 浩
Thnaks,

Your code semms to save members into DISK.
I found the next:

use Compress::Zlib;
my @files = $tar-list_files;
for my $file (@files) {
  my $filedata = $tar-get_content($file);
  my $dest = Compress::Zlib::memGunzip($filedata);
} 

Regards,
H.T.

Hello,

Anyone knows the way to read .gz members in .tar file?
I can read plain text files by the next code.
But when the member is .gz, I get uneadbale binay data.

use Archive::Tar;
my $file = shift;
my $tar = Archive::Tar-new($file, 1) or die Error 
Archive::Tar, :$!;
my @files = $tar-list_files;
for my $file (@files) {
   my $filedata = $tar-get_content($file);
   print $file:\n, $filedata, \n;
}

__END__






Hello,

you should unzip the gz files, with something like that:

(certainly no reference implementation)

use Archive::Zip;

sub unzip_file
{
my $file = shift;
my $zip = Archive::Zip-new($file);
my @members = $zip-memberNames();
#print Dumper \...@members;
#chdir($zip_directory);
foreach (@members)
{
$zip-extractMemberWithoutPaths($_ );
}
#chdir($start_dir);
} 


___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs