Subject: | Better compatibility with Archive::Extract |
Date: | Sun, 3 Mar 2019 11:45:29 -0500 |
To: | bug-Archive-Extract-Libarchive <bug-Archive-Extract-Libarchive [...] rt.cpan.org> |
From: | tlhackque <tlhackque [...] yahoo.com> |
It is useful to be able to replace Archive::Extract with
Archive::Extract::Libarchive when possible.
This allows the caller to take advantage of A::E::L's improved
performance without sacrificing portability.
The APIs are almost close enough for something like the following to work:
foreach my $ac (qw/Archive::Extract::Libarchive Archive::Extract/) {
if( eval "require $ac;" ) {
$aclass = $ac;
last;
}
}
die( $@ ) if( $@ );
my $ae = $aclass->new( archive => $filename, type => 'tgz' );
However, it would be helpful if A::E::L included at least the following
methods of A::E:
type() - return detected type of the archive
types() - return list of types supported
Support for these would make it easier to port A::E users to A::E::L.
Note:
The convenience methods (is_XXX) of A::E are not essential, as they can
be replaced in the caller.
The 'type' entry for new is ignored by A::E::L, which is not a problem.
Likewise, the BOOL argument to error() is ignored, also not a problem.
And the A::E globals (DEBUG, WARN, PREFER_BIN) can also safely be
ignored. (However, defining them would avoid "only used once"
warnings. They're easily suppressed in the caller.)
Documenting compatibility with A::E would also be nice.
Thanks.