On Fri Nov 16 07:04:31 2007, cfi wrote:
Show quoted text> IO::Uncompress::Base got installed when I installed AnyUncompress
>
> Gunzip is missing. Is this listed as a prerequisite of AnyUncompress?
I
Show quoted text> guess it's intentional if not, because everybody has different needs
and
Show quoted text> may not need a gzip interface.
It isn't a prerequisite for the very reason you mention.
Show quoted text>
> Would it make sense to add an API to the OO version of this module so
> that one could check for supported compression/inflation methods.
Yes, it would. It's on my list of possible enhancements.
Show quoted text> Sth like
> if (!defined( $obj->algorithms()->{gzip} )) {
> die "Cannot handle gzipped data";
> }
> Hm, but that would make sense only if Anyuncompress could test the
type
Show quoted text> of input file - even without those modules being installed. Then,
> additionally to the api above, it would be possible to do sth like:
> if ($obj->inflatable()) {
> die "Cannot handle ".$obj->packed_with()."'ed data";
> }
> The inflatable() method would check with that algorithm the file is
> acked (one of: qw(plain gzip bzip lzf)) and would compare that with
the
Show quoted text> available algorithms:
> sub inflatable($) {
> my ($self) = @_;
> return $self->algorithms()->{ $self->packed_with() };
> }
At the moment AnyUncompress has a hard-wired list of uncompression
modules that it makes use of to actually do the hard work.
I'll probably add a static method that will work like this
if (! AnyUncompress::canUncompress("gzip") )) {
die "Cannot handle gzipped data";
}
I still need to work out the exact interface for this.
Show quoted text>
> Back to my problem:
> I'll install that Gunzip module and recheck.
> Bear with me...
OK
Regarding your application, if you are only ever using gzip to compress
your data then you can use IO::Uncompress::Gunzip instead of
AnyUncompress.
If you are working with mixed compression formats, or want to future-
proof your code in case you change the compression format (to, say,
bzip2), then AnyUncompress is a good option.
Paul