Archive::Tar uncompress question

Hi,

I needed to use Archive::Tar today, and was bit by what I guess was an
unforseen use. I need to simply unpack an archive, optionally
decompressing it first. So, I have code like this:

    def expand
      t = Archive::Tar.new( @name )
      case @name
      when /\.tar\.bz2/
        t.expand
      when /\.bz2/
        t.uncompress("bunzip2")
      when /\.t(ar\.)?gz/
        t.expand
      when /\.gz/
        t.uncompress("gunzip")
      when /\.zip/
        t.uncompress("unzip")
      else
        raise UnknownArchiveError
      end
    end

which works fine for what I need *if* I redefine uncompress_archive like so:

<pseudo-patch>
- unless @compressed_archive_name
- raise CompressError, "no compressed file found"
- end
+ unless @compressed_archive_name
+ @compressed_archive_name = @archive_name
+ end
</pseudo-patch>

It seems that @compressed_archive_name can only be set if one first
compresses an archive. I don't need to do that here - I just need to
uncompress an already-existing archive.

Should I be redefining this method or should the package be changed to
the (my) expected behavior? Or have I just totally missed the usage
here? Has anyone else run up against this?

- Dimitri

...

I'm not sure. I'm just surprised that tarsimple uses Archive::Tar as
its name, instead of Archive::Tar::Wrapper or something like that,
since it's just a wrapper, and not a tar implementation in Ruby.

-austin

···

On 4/6/06, Dimitri Aivaliotis <aglarond@gmail.com> wrote:

I needed to use Archive::Tar today, and was bit by what I guess was an
unforseen use. I need to simply unpack an archive, optionally
decompressing it first. So, I have code like this:

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca