ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-UUlib/UUlib.pm
(Generate patch)

Comparing Convert-UUlib/UUlib.pm (file contents):
Revision 1.2 by root, Mon Jun 11 20:42:36 2001 UTC vs.
Revision 1.10 by root, Mon Aug 19 23:25:34 2002 UTC

4 4
5require Exporter; 5require Exporter;
6require DynaLoader; 6require DynaLoader;
7use AutoLoader; 7use AutoLoader;
8 8
9$VERSION = 0.111; 9$VERSION = 0.213;
10 10
11@ISA = qw(Exporter DynaLoader); 11@ISA = qw(Exporter DynaLoader);
12 12
13@_consts = qw( 13@_consts = qw(
14 ACT_COPYING ACT_DECODING ACT_ENCODING ACT_IDLE ACT_SCANNING 14 ACT_COPYING ACT_DECODING ACT_ENCODING ACT_IDLE ACT_SCANNING
19 MSG_ERROR MSG_FATAL MSG_MESSAGE MSG_NOTE MSG_PANIC MSG_WARNING 19 MSG_ERROR MSG_FATAL MSG_MESSAGE MSG_NOTE MSG_PANIC MSG_WARNING
20 20
21 OPT_BRACKPOL OPT_DEBUG OPT_DESPERATE OPT_DUMBNESS OPT_ENCEXT 21 OPT_BRACKPOL OPT_DEBUG OPT_DESPERATE OPT_DUMBNESS OPT_ENCEXT
22 OPT_ERRNO OPT_FAST OPT_IGNMODE OPT_IGNREPLY OPT_OVERWRITE OPT_PREAMB 22 OPT_ERRNO OPT_FAST OPT_IGNMODE OPT_IGNREPLY OPT_OVERWRITE OPT_PREAMB
23 OPT_PROGRESS OPT_SAVEPATH OPT_TINYB64 OPT_USETEXT OPT_VERBOSE 23 OPT_PROGRESS OPT_SAVEPATH OPT_TINYB64 OPT_USETEXT OPT_VERBOSE
24 OPT_VERSION OPT_REMOVE OPT_MOREMIME 24 OPT_VERSION OPT_REMOVE OPT_MOREMIME OPT_DOTDOT
25 25
26 RET_CANCEL RET_CONT RET_EXISTS RET_ILLVAL RET_IOERR RET_NODATA 26 RET_CANCEL RET_CONT RET_EXISTS RET_ILLVAL RET_IOERR RET_NODATA
27 RET_NOEND RET_NOMEM RET_OK RET_UNSUP 27 RET_NOEND RET_NOMEM RET_OK RET_UNSUP
28 28
29 B64ENCODED BH_ENCODED PT_ENCODED QP_ENCODED 29 B64ENCODED BH_ENCODED PT_ENCODED QP_ENCODED
30 XX_ENCODED UU_ENCODED 30 XX_ENCODED UU_ENCODED YENC_ENCODED
31); 31);
32 32
33@_funcs = qw( 33@_funcs = qw(
34 Initialize CleanUp GetOption SetOption strerror 34 Initialize CleanUp GetOption SetOption strerror SetMsgCallback
35 SetMsgCallback SetBusyCallback SetFileCallback 35 SetBusyCallback SetFileCallback SetFNameFilter SetFileNameCallback
36 SetFNameFilter FNameFilter LoadFile GetFileListItem 36 FNameFilter LoadFile GetFileListItem RenameFile DecodeToTemp
37 RenameFile DecodeToTemp RemoveTemp DecodeFile 37 RemoveTemp DecodeFile InfoFile Smerge QuickDecode EncodeMulti
38 InfoFile Smerge QuickDecode EncodeMulti EncodePartial 38 EncodePartial EncodeToStream EncodeToFile E_PrepSingle
39 EncodeToStream EncodeToFile E_PrepSingle E_PrepPartial 39 E_PrepPartial
40 40
41 straction strencoding strmsglevel 41 straction strencoding strmsglevel
42); 42);
43 43
44@EXPORT = @_consts; 44@EXPORT = @_consts;
62 return 'copying' if $_[0] == &ACT_COPYING; 62 return 'copying' if $_[0] == &ACT_COPYING;
63 return 'decoding' if $_[0] == &ACT_DECODING; 63 return 'decoding' if $_[0] == &ACT_DECODING;
64 return 'encoding' if $_[0] == &ACT_ENCODING; 64 return 'encoding' if $_[0] == &ACT_ENCODING;
65 return 'idle' if $_[0] == &ACT_IDLE; 65 return 'idle' if $_[0] == &ACT_IDLE;
66 return 'scanning' if $_[0] == &ACT_SCANNING; 66 return 'scanning' if $_[0] == &ACT_SCANNING;
67 (); 67 'unknown';
68} 68}
69 69
70# encoding type -> string mapping 70# encoding type -> string mapping
71sub strencoding($) { 71sub strencoding($) {
72 return 'uuencode' if $_[0] == &UU_ENCODED;
72 return 'base64' if $_[0] == &B64ENCODED; 73 return 'base64' if $_[0] == &B64ENCODED;
74 return 'yenc' if $_[0] == &YENC_ENCODED;
73 return 'binhex' if $_[0] == &BH_ENCODED; 75 return 'binhex' if $_[0] == &BH_ENCODED;
74 return 'plaintext' if $_[0] == &PT_ENCODED; 76 return 'plaintext' if $_[0] == &PT_ENCODED;
75 return 'quoted-printable' if $_[0] == &QP_ENCODED; 77 return 'quoted-printable' if $_[0] == &QP_ENCODED;
76 return 'xxencode' if $_[0] == &XX_ENCODED; 78 return 'xxencode' if $_[0] == &XX_ENCODED;
77 return 'uuencode' if $_[0] == &UU_ENCODED; 79 'unknown';
78 ();
79} 80}
80 81
81sub strmsglevel($) { 82sub strmsglevel($) {
82 return 'message' if $_[0] == &MSG_MESSAGE; 83 return 'message' if $_[0] == &MSG_MESSAGE;
83 return 'note' if $_[0] == &MSG_NOTE; 84 return 'note' if $_[0] == &MSG_NOTE;
84 return 'warning' if $_[0] == &MSG_WARNING; 85 return 'warning' if $_[0] == &MSG_WARNING;
85 return 'error' if $_[0] == &MSG_ERROR; 86 return 'error' if $_[0] == &MSG_ERROR;
86 return 'panic' if $_[0] == &MSG_PANIC; 87 return 'panic' if $_[0] == &MSG_PANIC;
87 return 'fatal' if $_[0] == &MSG_FATAL; 88 return 'fatal' if $_[0] == &MSG_FATAL;
88 (); 89 'unknown';
89} 90}
90 91
911; 921;
92__END__ 93__END__
93 94
225 RET_CANCEL RET_CONT RET_EXISTS RET_ILLVAL RET_IOERR 226 RET_CANCEL RET_CONT RET_EXISTS RET_ILLVAL RET_IOERR
226 RET_NODATA RET_NOEND RET_NOMEM RET_OK RET_UNSUP 227 RET_NODATA RET_NOEND RET_NOMEM RET_OK RET_UNSUP
227 228
228Encoding types: 229Encoding types:
229 230
230 B64ENCODED BH_ENCODED PT_ENCODED 231 B64ENCODED BH_ENCODED PT_ENCODED QP_ENCODED XX_ENCODED
231 QP_ENCODED XX_ENCODED UU_ENCODED 232 UU_ENCODED YENC_ENCODED
232 233
233=head1 Exported functions 234=head1 Exported functions
234 235
235Initializing and cleanup (Initialize is automatically called when the 236Initializing and cleanup (Initialize is automatically called when the
236module is loaded and allocates quite a bit of memory. CleanUp releases 237module is loaded and allocates quite a bit of memory. CleanUp releases
298 int EncodeToStream () ; 299 int EncodeToStream () ;
299 int EncodeToFile () ; 300 int EncodeToFile () ;
300 int E_PrepSingle () ; 301 int E_PrepSingle () ;
301 int E_PrepPartial () ; 302 int E_PrepPartial () ;
302 303
304=head2 EXTENSION FUNCTIONS
305
306Functions found in this module but not documented in the uulib documentation:
307
308=over 4
309
310=item SetFileNameCallback $cb
311
312Sets (or queries) the FileNameCallback, which is called whenever the
313decoding library can't find a filename and wants to extract a filename
314from the subject line of a posting. The callback will be called with
315two arguments, the subject line and the current candidate for the
316filename. The latter argument can be C<undef>, which means that no
317filename could be found (and likely no one exists, so it is safe to also
318return C<undef> in this case). If it doesn't return anything (not even
319C<undef>!), then nothing happens, so this is a no-op callback:
320
321 sub cb {
322 return ();
323 }
324
325If it returns C<undef>, then this indicates that no filename could be
326found. In all other cases, the return value is taken to be the filename.
327
328This is a slightly more useful callback:
329
330 sub cb {
331 return unless $_[1]; # skip "Re:"-plies et al.
332 my ($subject, $filename) = @_;
333 # if we find some *.rar, take it
334 return $1 if $subject =~ /(\w+\.rar)/;
335 # otherwise just pass what we have
336 return ();
337 }
338
339=back
340
303=head1 AUTHOR 341=head1 AUTHOR
304 342
305Marc Lehmann <pcg@goof.com>, the original uulib library was written by 343Marc Lehmann <pcg@goof.com>, the original uulib library was written by
306Frank Pilhofer <fp@informatik.uni-frankfurt.de>. 344Frank Pilhofer <fp@informatik.uni-frankfurt.de>.
307 345

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines