| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MIME::Decoder::UU; |
|
2
|
2
|
|
|
2
|
|
11
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
69
|
|
|
3
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
108
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
MIME::Decoder::UU - decode a "uuencoded" stream |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
A generic decoder object; see L for usage. |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Also supports a preamble() method to recover text before |
|
15
|
|
|
|
|
|
|
the uuencoded portion of the stream. |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
A MIME::Decoder subclass for a nonstandard encoding whereby |
|
21
|
|
|
|
|
|
|
data are uuencoded. Common non-standard MIME encodings for this: |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
x-uu |
|
24
|
|
|
|
|
|
|
x-uuencode |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
L |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 AUTHOR |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Eryq (F), ZeeGee Software Inc (F). |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
UU-decoding code lifted from "uuexplode", a Perl script by an |
|
35
|
|
|
|
|
|
|
unknown author... |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
All rights reserved. This program is free software; you can redistribute |
|
38
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
require 5.002; |
|
44
|
2
|
|
|
2
|
|
9
|
use vars qw(@ISA $VERSION); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
126
|
|
|
45
|
2
|
|
|
2
|
|
10
|
use MIME::Decoder; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
47
|
|
|
46
|
2
|
|
|
2
|
|
9
|
use MIME::Tools qw(whine); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
1187
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
@ISA = qw(MIME::Decoder); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# The package version, both in 1.23 style *and* usable by MakeMaker: |
|
51
|
|
|
|
|
|
|
$VERSION = "5.508"; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#------------------------------ |
|
55
|
|
|
|
|
|
|
# |
|
56
|
|
|
|
|
|
|
# decode_it IN, OUT |
|
57
|
|
|
|
|
|
|
# |
|
58
|
|
|
|
|
|
|
sub decode_it { |
|
59
|
7
|
|
|
7
|
1
|
9
|
my ($self, $in, $out) = @_; |
|
60
|
7
|
|
|
|
|
7
|
my ($mode, $file); |
|
61
|
0
|
|
|
|
|
0
|
my @preamble; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
### Init: |
|
64
|
7
|
|
|
|
|
13
|
$self->{MDU_Preamble} = \@preamble; |
|
65
|
7
|
|
|
|
|
13
|
$self->{MDU_Mode} = undef; |
|
66
|
7
|
|
|
|
|
9
|
$self->{MDU_File} = undef; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
### Find beginning... |
|
69
|
7
|
|
|
|
|
9
|
local $_; |
|
70
|
7
|
|
|
|
|
170
|
while (defined($_ = $in->getline)) { |
|
71
|
16
|
100
|
|
|
|
355
|
if (/^begin(.*)/) { ### found it: now decode it... |
|
72
|
5
|
|
|
|
|
9
|
my $modefile = $1; |
|
73
|
5
|
50
|
|
|
|
31
|
if ($modefile =~ /^(\s+(\d+))?(\s+(.*?\S))?\s*\Z/) { |
|
74
|
5
|
|
|
|
|
11
|
($mode, $file) = ($2, $4); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
5
|
|
|
|
|
9
|
last; ### decoded or not, we're done |
|
77
|
|
|
|
|
|
|
} |
|
78
|
11
|
|
|
|
|
146
|
push @preamble, $_; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
7
|
100
|
|
|
|
67
|
die("uu decoding: no begin found\n") if !defined($_); # hit eof! |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
### Store info: |
|
83
|
5
|
|
|
|
|
9
|
$self->{MDU_Mode} = $mode; |
|
84
|
5
|
|
|
|
|
20
|
$self->{MDU_File} = $file; |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
### Decode: |
|
87
|
5
|
|
|
|
|
91
|
while (defined($_ = $in->getline)) { |
|
88
|
299
|
100
|
|
|
|
10833
|
last if /^end/; |
|
89
|
294
|
50
|
|
|
|
450
|
next if /[a-z]/; |
|
90
|
294
|
50
|
|
|
|
627
|
next unless int((((ord() - 32) & 077) + 2) / 3) == int(length() / 4); |
|
91
|
294
|
|
|
|
|
831
|
$out->print(unpack('u', $_)); |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
### chmod oct($mode), $file; # sheeyeah... right... |
|
94
|
5
|
50
|
|
|
|
11
|
whine "file incomplete, no end found\n" if !defined($_); # eof |
|
95
|
5
|
|
|
|
|
18
|
1; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
#------------------------------ |
|
99
|
|
|
|
|
|
|
# |
|
100
|
|
|
|
|
|
|
# encode_it IN, OUT |
|
101
|
|
|
|
|
|
|
# |
|
102
|
|
|
|
|
|
|
sub encode_it { |
|
103
|
1
|
|
|
1
|
1
|
4
|
my ($self, $in, $out) = @_; |
|
104
|
1
|
|
|
|
|
2
|
my $buf = ''; |
|
105
|
|
|
|
|
|
|
|
|
106
|
1
|
|
50
|
|
|
8
|
my $fname = (($self->head && |
|
107
|
|
|
|
|
|
|
$self->head->mime_attr('content-disposition.filename')) || |
|
108
|
|
|
|
|
|
|
''); |
|
109
|
1
|
|
|
|
|
6
|
$out->print("begin 644 $fname\n"); |
|
110
|
1
|
|
|
|
|
10
|
while ($in->read($buf, 45)) { $out->print(pack('u', $buf)) } |
|
|
68
|
|
|
|
|
631
|
|
|
111
|
1
|
|
|
|
|
12
|
$out->print("end\n"); |
|
112
|
1
|
|
|
|
|
9
|
1; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
#------------------------------ |
|
116
|
|
|
|
|
|
|
# |
|
117
|
|
|
|
|
|
|
# last_preamble |
|
118
|
|
|
|
|
|
|
# |
|
119
|
|
|
|
|
|
|
# Return the last preamble as ref to array of lines. |
|
120
|
|
|
|
|
|
|
# Gets reset by decode_it(). |
|
121
|
|
|
|
|
|
|
# |
|
122
|
|
|
|
|
|
|
sub last_preamble { |
|
123
|
4
|
|
|
4
|
0
|
4
|
my $self = shift; |
|
124
|
4
|
|
50
|
|
|
14
|
return $self->{MDU_Preamble} || []; |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
#------------------------------ |
|
128
|
|
|
|
|
|
|
# |
|
129
|
|
|
|
|
|
|
# last_mode |
|
130
|
|
|
|
|
|
|
# |
|
131
|
|
|
|
|
|
|
# Return the last mode. |
|
132
|
|
|
|
|
|
|
# Gets reset to undef by decode_it(). |
|
133
|
|
|
|
|
|
|
# |
|
134
|
|
|
|
|
|
|
sub last_mode { |
|
135
|
4
|
|
|
4
|
0
|
10
|
shift->{MDU_Mode}; |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
#------------------------------ |
|
139
|
|
|
|
|
|
|
# |
|
140
|
|
|
|
|
|
|
# last_filename |
|
141
|
|
|
|
|
|
|
# |
|
142
|
|
|
|
|
|
|
# Return the last filename. |
|
143
|
|
|
|
|
|
|
# Gets reset by decode_it(). |
|
144
|
|
|
|
|
|
|
# |
|
145
|
|
|
|
|
|
|
sub last_filename { |
|
146
|
4
|
50
|
|
4
|
0
|
13
|
shift->{MDU_File} || []; |
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
#------------------------------ |
|
150
|
|
|
|
|
|
|
1; |