line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MIME::Decoder::Binary; |
2
|
7
|
|
|
7
|
|
28
|
use strict; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
201
|
|
3
|
7
|
|
|
7
|
|
23
|
use warnings; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
237
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
MIME::Decoder::Binary - perform no encoding/decoding |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
A generic decoder object; see L for usage. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
A MIME::Decoder subclass for the C<"binary"> encoding (in other words, |
19
|
|
|
|
|
|
|
no encoding). |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
The C<"binary"> decoder is a special case, since it's ill-advised |
22
|
|
|
|
|
|
|
to read the input line-by-line: after all, an uncompressed image file might |
23
|
|
|
|
|
|
|
conceivably have loooooooooong stretches of bytes without a C<"\n"> among |
24
|
|
|
|
|
|
|
them, and we don't want to risk blowing out our core. So, we |
25
|
|
|
|
|
|
|
read-and-write fixed-size chunks. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Both the B and B do a simple pass-through of the data |
28
|
|
|
|
|
|
|
from input to output. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 SEE ALSO |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
L |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 AUTHOR |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Eryq (F), ZeeGee Software Inc (F). |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
All rights reserved. This program is free software; you can redistribute |
40
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
7
|
|
|
7
|
|
27
|
use MIME::Decoder; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
160
|
|
45
|
7
|
|
|
7
|
|
27
|
use vars qw(@ISA $VERSION); |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
1353
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
@ISA = qw(MIME::Decoder); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
### The package version, both in 1.23 style *and* usable by MakeMaker: |
50
|
|
|
|
|
|
|
$VERSION = "5.509"; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
### Buffer length: |
53
|
|
|
|
|
|
|
my $BUFLEN = 8192; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
#------------------------------ |
56
|
|
|
|
|
|
|
# |
57
|
|
|
|
|
|
|
# decode_it IN, OUT |
58
|
|
|
|
|
|
|
# |
59
|
|
|
|
|
|
|
sub decode_it { |
60
|
13
|
|
|
13
|
1
|
19
|
my ($self, $in, $out) = @_; |
61
|
|
|
|
|
|
|
|
62
|
13
|
|
|
|
|
16
|
my ($buf, $nread) = ('', 0); |
63
|
13
|
|
|
|
|
50
|
while ($nread = $in->read($buf, $BUFLEN)) { |
64
|
13
|
|
|
|
|
194
|
$out->print($buf); |
65
|
|
|
|
|
|
|
} |
66
|
13
|
50
|
|
|
|
156
|
defined($nread) or return undef; ### check for error |
67
|
13
|
|
|
|
|
33
|
1; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
#------------------------------ |
71
|
|
|
|
|
|
|
# |
72
|
|
|
|
|
|
|
# encode_it IN, OUT |
73
|
|
|
|
|
|
|
# |
74
|
|
|
|
|
|
|
sub encode_it { |
75
|
21
|
|
|
21
|
1
|
25
|
my ($self, $in, $out) = @_; |
76
|
|
|
|
|
|
|
|
77
|
21
|
|
|
|
|
27
|
my ($buf, $nread) = ('', 0); |
78
|
21
|
|
|
|
|
72
|
while ($nread = $in->read($buf, $BUFLEN)) { |
79
|
21
|
|
|
|
|
335
|
$out->print($buf); |
80
|
|
|
|
|
|
|
} |
81
|
21
|
50
|
|
|
|
207
|
defined($nread) or return undef; ### check for error |
82
|
21
|
|
|
|
|
130
|
1; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
#------------------------------ |
86
|
|
|
|
|
|
|
1; |