Skip to content
Browse files

monkey patch to support bzip2

  • Loading branch information...
1 parent 5a521df commit d269f76c37b07ddcc2ce3a61726cda557a986dd9 @monken monken committed Apr 25, 2011
Showing with 51 additions and 0 deletions.
  1. +51 −0 lib/Archive/Any/Plugin/Tar.pm
View
51 lib/Archive/Any/Plugin/Tar.pm
@@ -0,0 +1,51 @@
+package Archive::Any::Plugin::Tar;
+use strict;
+use base 'Archive::Any::Plugin';
+
+use Archive::Tar;
+use Cwd;
+
+=head1 NAME
+
+Archive::Any::Plugin::Tar - Archive::Any wrapper around Archive::Tar
+
+=head1 SYNOPSIS
+
+Do not use this module directly. Instead, use Archive::Any.
+
+=cut
+
+sub can_handle {
+ return(
+ 'application/x-tar',
+ 'application/x-gtar',
+ 'application/x-gzip',
+ 'application/x-bzip2',
+ );
+}
+
+sub files {
+ my( $self, $file ) = @_;
+ my $t = Archive::Tar->new( $file );
+ return $t->list_files;
+}
+
+sub extract {
+ my ( $self, $file ) = @_;
+
+ my $t = Archive::Tar->new( $file );
+ return $t->extract;
+}
+
+sub type {
+ my $self = shift;
+ return 'tar';
+}
+
+=head1 SEE ALSO
+
+Archive::Any, Archive::Tar
+
+=cut
+
+1;

0 comments on commit d269f76

Please sign in to comment.
Something went wrong with that request. Please try again.