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

Reply via email to