line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MIME::Expander::Plugin::ApplicationTar; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
36075
|
use strict; |
|
4
|
|
|
|
|
28
|
|
|
4
|
|
|
|
|
153
|
|
4
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
123
|
|
5
|
4
|
|
|
4
|
|
19
|
use vars qw($VERSION); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
241
|
|
6
|
|
|
|
|
|
|
$VERSION = '0.01'; |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
1567
|
use parent qw(MIME::Expander::Plugin); |
|
4
|
|
|
|
|
477
|
|
|
4
|
|
|
|
|
28
|
|
9
|
|
|
|
|
|
|
__PACKAGE__->mk_classdata('ACCEPT_TYPES' => [qw( |
10
|
|
|
|
|
|
|
application/tar |
11
|
|
|
|
|
|
|
application/x-tar |
12
|
|
|
|
|
|
|
)]); |
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
4
|
|
5564
|
use Archive::Tar; |
|
4
|
|
|
|
|
481557
|
|
|
4
|
|
|
|
|
353
|
|
15
|
4
|
|
|
4
|
|
4060
|
use IO::Scalar; |
|
4
|
|
|
|
|
19144
|
|
|
4
|
|
|
|
|
848
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub expand { |
18
|
4
|
|
|
4
|
0
|
10
|
my $self = shift; |
19
|
4
|
|
|
|
|
8
|
my $contents = shift; |
20
|
4
|
|
|
|
|
10
|
my $callback = shift; |
21
|
4
|
|
|
|
|
8
|
my $c = 0; |
22
|
|
|
|
|
|
|
|
23
|
4
|
50
|
|
|
|
62
|
my $iter = Archive::Tar->iter(IO::Scalar->new( |
24
|
|
|
|
|
|
|
ref $contents eq 'SCALAR' ? $contents : \$contents |
25
|
|
|
|
|
|
|
)); |
26
|
4
|
|
|
|
|
861
|
while( my $f = $iter->() ){ |
27
|
12
|
100
|
66
|
|
|
5768
|
if( $f->has_content and $f->validate ){ |
28
|
8
|
50
|
|
|
|
408
|
$callback->( $f->get_content_by_ref, { |
29
|
|
|
|
|
|
|
filename => $f->full_path, |
30
|
|
|
|
|
|
|
} ) if( ref $callback eq 'CODE' ); |
31
|
8
|
|
|
|
|
7136
|
++$c; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
4
|
|
|
|
|
592
|
return $c; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
__END__ |