line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MIME::Expander::Plugin::ApplicationTar; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
97742
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
132
|
|
4
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
106
|
|
5
|
4
|
|
|
4
|
|
16
|
use vars qw($VERSION); |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
206
|
|
6
|
|
|
|
|
|
|
$VERSION = '0.02'; |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
16
|
use parent qw(MIME::Expander::Plugin); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
28
|
|
9
|
|
|
|
|
|
|
__PACKAGE__->mk_classdata('ACCEPT_TYPES' => [qw( |
10
|
|
|
|
|
|
|
application/tar |
11
|
|
|
|
|
|
|
)]); |
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
4
|
|
2995
|
use Archive::Tar; |
|
4
|
|
|
|
|
261608
|
|
|
4
|
|
|
|
|
340
|
|
14
|
4
|
|
|
4
|
|
2387
|
use IO::Scalar; |
|
4
|
|
|
|
|
12654
|
|
|
4
|
|
|
|
|
655
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub expand { |
17
|
5
|
|
|
5
|
0
|
4420
|
my $self = shift; |
18
|
5
|
|
|
|
|
9
|
my $part = shift; |
19
|
5
|
|
|
|
|
10
|
my $callback = shift; |
20
|
5
|
|
|
|
|
8
|
my $c = 0; |
21
|
|
|
|
|
|
|
|
22
|
5
|
|
|
|
|
19
|
my $contents = $part->body; |
23
|
5
|
|
|
|
|
631
|
my $iter = Archive::Tar->iter(IO::Scalar->new( |
24
|
|
|
|
|
|
|
\$contents, |
25
|
|
|
|
|
|
|
)); |
26
|
5
|
|
|
|
|
672
|
while( my $f = $iter->() ){ |
27
|
15
|
100
|
66
|
|
|
5403
|
if( $f->has_content and $f->validate ){ |
28
|
10
|
50
|
|
|
|
370
|
$callback->( $f->get_content_by_ref, { |
29
|
|
|
|
|
|
|
filename => $f->full_path, |
30
|
|
|
|
|
|
|
} ) if( ref $callback eq 'CODE' ); |
31
|
10
|
|
|
|
|
6480
|
++$c; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
5
|
|
|
|
|
790
|
return $c; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
__END__ |