1 | package Convert::UUlib; |
1 | package Convert::UUlib; |
|
|
2 | |
|
|
3 | no warnings; |
|
|
4 | use strict; |
2 | |
5 | |
3 | use Carp; |
6 | use Carp; |
4 | |
7 | |
5 | require Exporter; |
8 | require Exporter; |
6 | require DynaLoader; |
9 | require DynaLoader; |
7 | |
10 | |
8 | $VERSION = "1.0"; |
11 | our $VERSION = '1.08'; |
9 | |
12 | |
10 | @ISA = qw(Exporter DynaLoader); |
13 | our @ISA = qw(Exporter DynaLoader); |
11 | |
14 | |
12 | @_consts = qw( |
15 | our @_consts = qw( |
13 | ACT_COPYING ACT_DECODING ACT_ENCODING ACT_IDLE ACT_SCANNING |
16 | ACT_COPYING ACT_DECODING ACT_ENCODING ACT_IDLE ACT_SCANNING |
14 | |
17 | |
15 | FILE_DECODED FILE_ERROR FILE_MISPART FILE_NOBEGIN FILE_NODATA |
18 | FILE_DECODED FILE_ERROR FILE_MISPART FILE_NOBEGIN FILE_NODATA |
16 | FILE_NOEND FILE_OK FILE_READ FILE_TMPFILE |
19 | FILE_NOEND FILE_OK FILE_READ FILE_TMPFILE |
17 | |
20 | |
18 | MSG_ERROR MSG_FATAL MSG_MESSAGE MSG_NOTE MSG_PANIC MSG_WARNING |
21 | MSG_ERROR MSG_FATAL MSG_MESSAGE MSG_NOTE MSG_PANIC MSG_WARNING |
19 | |
22 | |
|
|
23 | OPT_RBUF OPT_WBUF |
20 | OPT_BRACKPOL OPT_DEBUG OPT_DESPERATE OPT_DUMBNESS OPT_ENCEXT |
24 | OPT_BRACKPOL OPT_DEBUG OPT_DESPERATE OPT_DUMBNESS OPT_ENCEXT |
21 | OPT_ERRNO OPT_FAST OPT_IGNMODE OPT_IGNREPLY OPT_OVERWRITE OPT_PREAMB |
25 | OPT_ERRNO OPT_FAST OPT_IGNMODE OPT_IGNREPLY OPT_OVERWRITE OPT_PREAMB |
22 | OPT_PROGRESS OPT_SAVEPATH OPT_TINYB64 OPT_USETEXT OPT_VERBOSE |
26 | OPT_PROGRESS OPT_SAVEPATH OPT_TINYB64 OPT_USETEXT OPT_VERBOSE |
23 | OPT_VERSION OPT_REMOVE OPT_MOREMIME OPT_DOTDOT |
27 | OPT_VERSION OPT_REMOVE OPT_MOREMIME OPT_DOTDOT |
24 | |
28 | |
… | |
… | |
27 | |
31 | |
28 | B64_ENCODED BH_ENCODED PT_ENCODED QP_ENCODED |
32 | B64_ENCODED BH_ENCODED PT_ENCODED QP_ENCODED |
29 | XX_ENCODED UU_ENCODED YENC_ENCODED |
33 | XX_ENCODED UU_ENCODED YENC_ENCODED |
30 | ); |
34 | ); |
31 | |
35 | |
32 | @_funcs = qw( |
36 | our @_funcs = qw( |
33 | Initialize CleanUp GetOption SetOption strerror SetMsgCallback |
37 | Initialize CleanUp GetOption SetOption strerror SetMsgCallback |
34 | SetBusyCallback SetFileCallback SetFNameFilter SetFileNameCallback |
38 | SetBusyCallback SetFileCallback SetFNameFilter SetFileNameCallback |
35 | FNameFilter LoadFile GetFileListItem RenameFile DecodeToTemp |
39 | FNameFilter LoadFile GetFileListItem RenameFile DecodeToTemp |
36 | RemoveTemp DecodeFile InfoFile Smerge QuickDecode EncodeMulti |
40 | RemoveTemp DecodeFile InfoFile Smerge QuickDecode EncodeMulti |
37 | EncodePartial EncodeToStream EncodeToFile E_PrepSingle |
41 | EncodePartial EncodeToStream EncodeToFile E_PrepSingle |
38 | E_PrepPartial |
42 | E_PrepPartial |
39 | |
43 | |
40 | straction strencoding strmsglevel |
44 | straction strencoding strmsglevel |
41 | ); |
45 | ); |
42 | |
46 | |
43 | @EXPORT = @_consts; |
47 | our @EXPORT = @_consts; |
44 | @EXPORT_OK = @_funcs; |
48 | our @EXPORT_OK = @_funcs; |
45 | %EXPORT_TAGS = (all => [@_consts,@_funcs], constants => \@_consts); |
49 | our %EXPORT_TAGS = (all => [@_consts,@_funcs], constants => \@_consts); |
46 | |
50 | |
47 | bootstrap Convert::UUlib $VERSION; |
51 | bootstrap Convert::UUlib $VERSION; |
48 | |
52 | |
49 | Initialize(); |
53 | Initialize(); |
50 | |
54 | |
51 | # not when < 5.005_6x |
55 | # not when < 5.005_6x |
52 | # END { CleanUp() } |
56 | # END { CleanUp() } |
53 | |
57 | |
54 | for (@_consts) { |
58 | for (@_consts) { |
55 | my $constant = constant($_); |
59 | my $constant = constant($_); |
|
|
60 | no strict 'refs'; |
56 | *$_ = sub () { $constant }; |
61 | *$_ = sub () { $constant }; |
57 | } |
62 | } |
58 | |
63 | |
59 | # action code -> string mapping |
64 | # action code -> string mapping |
60 | sub straction($) { |
65 | sub straction($) { |
… | |
… | |
154 | OPT_TINYB64 detect short B64 outside of Mime |
159 | OPT_TINYB64 detect short B64 outside of Mime |
155 | OPT_ENCEXT extension for single-part encoded files |
160 | OPT_ENCEXT extension for single-part encoded files |
156 | OPT_REMOVE remove input files after decoding (dangerous) |
161 | OPT_REMOVE remove input files after decoding (dangerous) |
157 | OPT_MOREMIME strict MIME adherence |
162 | OPT_MOREMIME strict MIME adherence |
158 | OPT_DOTDOT ".."-unescaping has not yet been done on input files |
163 | OPT_DOTDOT ".."-unescaping has not yet been done on input files |
|
|
164 | OPT_RBUF set default read I/O buffer size in bytes *EXPERIMENTAL* |
|
|
165 | OPT_WBUF set default write I/O buffer size in bytes *EXPERIMENTAL* |
159 | |
166 | |
160 | =head2 Result/Error codes |
167 | =head2 Result/Error codes |
161 | |
168 | |
162 | RET_OK everything went fine |
169 | RET_OK everything went fine |
163 | RET_IOERR I/O Error - examine errno |
170 | RET_IOERR I/O Error - examine errno |
… | |
… | |
261 | |
268 | |
262 | =item ($retval, $count) = LoadFile $fname, [$id, [$delflag, [$partno]]] |
269 | =item ($retval, $count) = LoadFile $fname, [$id, [$delflag, [$partno]]] |
263 | |
270 | |
264 | Load the given file and scan it for encoded contents. Optionally tag it |
271 | Load the given file and scan it for encoded contents. Optionally tag it |
265 | with the given id, and if C<$delflag> is true, delete the file after it |
272 | with the given id, and if C<$delflag> is true, delete the file after it |
266 | is no longer necessary. If you are certain of the part number, you cna |
273 | is no longer necessary. If you are certain of the part number, you can |
267 | specify it as the lat argument. |
274 | specify it as the last argument. |
268 | |
275 | |
269 | A better (usually faster) way of doing this is using the C<SetFNameFilter> |
276 | A better (usually faster) way of doing this is using the C<SetFNameFilter> |
270 | functionality. |
277 | functionality. |
271 | |
278 | |
272 | =item $retval = Smerge $pass |
279 | =item $retval = Smerge $pass |
… | |
… | |
534 | |
541 | |
535 | CleanUp(); |
542 | CleanUp(); |
536 | |
543 | |
537 | =head1 AUTHOR |
544 | =head1 AUTHOR |
538 | |
545 | |
539 | Marc Lehmann <pcg@goof.com>, the original uulib library was written |
546 | Marc Lehmann <schmorp@schmorp.de>, the original uulib library was written |
540 | by Frank Pilhofer <fp@informatik.uni-frankfurt.de>, and later heavily |
547 | by Frank Pilhofer <fp@informatik.uni-frankfurt.de>, and later heavily |
541 | bugfixed by Marc Lehmann. |
548 | bugfixed by Marc Lehmann. |
542 | |
549 | |
543 | =head1 SEE ALSO |
550 | =head1 SEE ALSO |
544 | |
551 | |