in reply to Re^2: how to get filesize
in thread how to get filesize

Archive::Tar is more portable...

GNU tar (compiled C) is freely available for all platforms that run Perl, can't be beat for speed, and will always work regardless of how big the tar file happens to be.

(The only OS-dependent limitation, last time I checked, is that on mswin, you can't do things like "tar czf file.tar.gz source/" or "tar xzf file.tar.gz" or "tar tzvf file.tar.gz", to handle gzip compression directly -- you have to do "gzip" or "gunzip" as a separate step.)

Meanwhile, Archive::Tar tries to accommodate both uncompressed and compressed tar files by always loading the full, uncompressed tar file contents into memory, which means that it won't handle really large tar files. (In this sense, it's "less portable".)

Replies are listed 'Best First'.
Re^4: how to get filesize
by jettero (Monsignor) on Dec 16, 2006 at 15:16 UTC
    I agree with you 100% and my original answer had open my $in, "tar -ztvvf $filename|" and a regex to catch the file size. But I didn't want to then explain finding and installing tar.exe, so I used the module instead. It's the same basic idea, but even easier with open imo...

    Besides, are you sure it reads the whole file into memory for the list_files()? I thought that was only for the unpack. Yeah, it definitely does. In my opinion, it shouldn't do that, oh well.

    -Paul