| 1 | package Archive::Any::Plugin::Rar; | ||
| 2 | |||
| 3 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 3 | ▶ | use base 'Archive::Any::Plugin'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 0 | ▶ | use Archive::Rar; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | Archive::Any::Plugin::Rar - Archive::Any wrapper around Archive::Rar | ||
| 13 | |||
| 14 | =cut | ||
| 15 | |||
| 16 | our $VERSION = '0.02'; | ||
| 17 | |||
| 18 | |||
| 19 | =head1 SYNOPSIS | ||
| 20 | |||
| 21 | Do not use this module directly. Instead, use Archive::Any. | ||
| 22 | |||
| 23 | =cut | ||
| 24 | |||
| 25 | sub can_handle { | ||
| 26 | return( | ||
| 27 | 'application/x-rar', | ||
| 28 | 'application/x-rar-compressed', | ||
| 29 | ); | ||
| 30 | } | ||
| 31 | |||
| 32 | sub files { | ||
| 33 | my( $self, $file ) = @_; | ||
| 34 | my $t = Archive::Rar->new( -archive => $file ); | ||
| 35 | $t->List(); | ||
| 36 | map { $_->{name} } @{$t->{list}}; | ||
| 37 | } | ||
| 38 | |||
| 39 | sub extract { | ||
| 40 | my ( $self, $file ) = @_; | ||
| 41 | |||
| 42 | my $t = Archive::Rar->new( -archive => $file, -quiet => 'True' ); | ||
| 43 | return $t->Extract; | ||
| 44 | } | ||
| 45 | |||
| 46 | sub type { | ||
| 47 | my $self = shift; | ||
| 48 | return 'rar'; | ||
| 49 | } | ||
| 50 | |||
| 51 | =head1 SEE ALSO | ||
| 52 | |||
| 53 | Archive::Any, Archive::Rar | ||
| 54 | |||
| 55 | =head1 AUTHOR | ||
| 56 | |||
| 57 | Dmitriy V. Simonov, C<< <dsimonov at gmail.com> >> | ||
| 58 | |||
| 59 | =head1 ACKNOWLEDGEMENTS | ||
| 60 | |||
| 61 | Thanks to Clint Moore for L<Archive::Any> | ||
| 62 | |||
| 63 | Thanks to C<< <d_ion at mail.ru> >> for minor fix | ||
| 64 | |||
| 65 | Thanks to C<< <ksuri at cpan.org> >> for major fix | ||
| 66 | |||
| 67 | =head1 COPYRIGHT & LICENSE | ||
| 68 | |||
| 69 | Copyright 2010 Dmitriy V. Simonov. | ||
| 70 | |||
| 71 | This program is free software; you can redistribute it and/or modify it | ||
| 72 | under the terms of either: the GNU General Public License as published | ||
| 73 | by the Free Software Foundation; or the Artistic License. | ||
| 74 | |||
| 75 | =cut | ||
| 76 | |||
| 77 | 1; # End of Archive::Any::Plugin::Rar | ||