line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Packager::Extractor; |
2
|
2
|
|
|
2
|
|
13
|
use Mouse; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
3
|
2
|
|
|
2
|
|
3244
|
use Archive::Extract; |
|
2
|
|
|
|
|
186151
|
|
|
2
|
|
|
|
|
106
|
|
4
|
2
|
|
|
2
|
|
1499
|
use CPAN::Packager::Home; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
65
|
|
5
|
2
|
|
|
2
|
|
12
|
use CPAN::Packager::FileUtil qw(dir); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
563
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has 'extract_dir' => ( |
8
|
|
|
|
|
|
|
is => 'rw', |
9
|
|
|
|
|
|
|
default => sub { |
10
|
|
|
|
|
|
|
dir( CPAN::Packager::Home->detect, 'custom_module' ); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub BUILD { |
15
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
16
|
0
|
|
|
|
|
|
File::Path::mkpath($self->extract_dir); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub extract { |
20
|
0
|
|
|
0
|
0
|
|
my ($self, $file) = @_; |
21
|
0
|
|
|
|
|
|
$self->_extract_to_default_dir($file, $self->extract_dir); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _extract_to_default_dir { |
25
|
0
|
|
|
0
|
|
|
my ( $self, $file, $to ) = @_; |
26
|
0
|
|
|
|
|
|
my $extractor = Archive::Extract->new( archive => $file ); |
27
|
0
|
0
|
|
|
|
|
unless ( $extractor->extract( to => $to ) ) { |
28
|
0
|
|
|
|
|
|
die "Unable to extract $file, to $to: $extractor->error"; |
29
|
|
|
|
|
|
|
} |
30
|
0
|
|
|
|
|
|
return $extractor->extract_path; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
2
|
|
13
|
no Mouse; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
22
|
|
34
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
__END__ |