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.16 by root, Thu Nov 6 13:33:40 2003 UTC vs.
Revision 1.58 by root, Sun Jan 29 05:04:51 2023 UTC

1package Convert::UUlib; 1package Convert::UUlib;
2
3use common::sense;
2 4
3use Carp; 5use Carp;
4 6
5require Exporter; 7require Exporter;
6require DynaLoader; 8require DynaLoader;
7 9
8$VERSION = 1; 10our $VERSION = 1.8;
9 11
10@ISA = qw(Exporter DynaLoader); 12our @ISA = qw(Exporter DynaLoader);
11 13
12@_consts = qw( 14our @_consts = qw(
13 ACT_COPYING ACT_DECODING ACT_ENCODING ACT_IDLE ACT_SCANNING 15 ACT_COPYING ACT_DECODING ACT_ENCODING ACT_IDLE ACT_SCANNING
14 16
15 FILE_DECODED FILE_ERROR FILE_MISPART FILE_NOBEGIN FILE_NODATA 17 FILE_DECODED FILE_ERROR FILE_MISPART FILE_NOBEGIN FILE_NODATA
16 FILE_NOEND FILE_OK FILE_READ FILE_TMPFILE 18 FILE_NOEND FILE_OK FILE_READ FILE_TMPFILE
17 19
18 MSG_ERROR MSG_FATAL MSG_MESSAGE MSG_NOTE MSG_PANIC MSG_WARNING 20 MSG_ERROR MSG_FATAL MSG_MESSAGE MSG_NOTE MSG_PANIC MSG_WARNING
19 21
22 OPT_RBUF OPT_WBUF
20 OPT_BRACKPOL OPT_DEBUG OPT_DESPERATE OPT_DUMBNESS OPT_ENCEXT 23 OPT_BRACKPOL OPT_DEBUG OPT_DESPERATE OPT_DUMBNESS OPT_ENCEXT
21 OPT_ERRNO OPT_FAST OPT_IGNMODE OPT_IGNREPLY OPT_OVERWRITE OPT_PREAMB 24 OPT_ERRNO OPT_FAST OPT_IGNMODE OPT_IGNREPLY OPT_OVERWRITE OPT_PREAMB
22 OPT_PROGRESS OPT_SAVEPATH OPT_TINYB64 OPT_USETEXT OPT_VERBOSE 25 OPT_PROGRESS OPT_SAVEPATH OPT_TINYB64 OPT_USETEXT OPT_VERBOSE
23 OPT_VERSION OPT_REMOVE OPT_MOREMIME OPT_DOTDOT 26 OPT_VERSION OPT_REMOVE OPT_MOREMIME OPT_DOTDOT OPT_AUTOCHECK
24 27
25 RET_CANCEL RET_CONT RET_EXISTS RET_ILLVAL RET_IOERR RET_NODATA 28 RET_CANCEL RET_CONT RET_EXISTS RET_ILLVAL RET_IOERR RET_NODATA
26 RET_NOEND RET_NOMEM RET_OK RET_UNSUP 29 RET_NOEND RET_NOMEM RET_OK RET_UNSUP
27 30
28 B64_ENCODED BH_ENCODED PT_ENCODED QP_ENCODED 31 B64_ENCODED BH_ENCODED PT_ENCODED QP_ENCODED
29 XX_ENCODED UU_ENCODED YENC_ENCODED 32 XX_ENCODED UU_ENCODED YENC_ENCODED
30); 33);
31 34
32@_funcs = qw( 35our @_funcs = qw(
33 Initialize CleanUp GetOption SetOption strerror SetMsgCallback 36 Initialize CleanUp GetOption SetOption strerror SetMsgCallback
34 SetBusyCallback SetFileCallback SetFNameFilter SetFileNameCallback 37 SetBusyCallback SetFileCallback SetFNameFilter SetFileNameCallback
35 FNameFilter LoadFile GetFileListItem RenameFile DecodeToTemp 38 FNameFilter LoadFile GetFileListItem GetFileList RenameFile DecodeToTemp
36 RemoveTemp DecodeFile InfoFile Smerge QuickDecode EncodeMulti 39 RemoveTemp DecodeFile InfoFile Smerge QuickDecode EncodeMulti
37 EncodePartial EncodeToStream EncodeToFile E_PrepSingle 40 EncodePartial EncodeToStream EncodeToFile E_PrepSingle
38 E_PrepPartial 41 E_PrepPartial
39 42
40 straction strencoding strmsglevel 43 straction strencoding strmsglevel
41); 44);
42 45
43@EXPORT = @_consts; 46our @EXPORT = @_consts;
44@EXPORT_OK = @_funcs; 47our @EXPORT_OK = @_funcs;
45%EXPORT_TAGS = (all => [@_consts,@_funcs], constants => \@_consts); 48our %EXPORT_TAGS = (all => [@_consts,@_funcs], constants => \@_consts);
46 49
47bootstrap Convert::UUlib $VERSION; 50bootstrap Convert::UUlib $VERSION;
48 51
49Initialize(); 52# dummy function for compatiiblity with pre-1.7 versions
50 53sub Initialize { }
51# not when < 5.005_6x
52# END { CleanUp() }
53
54for (@_consts) {
55 my $constant = constant($_);
56 *$_ = sub () { $constant };
57}
58 54
59# action code -> string mapping 55# action code -> string mapping
60sub straction($) { 56sub straction($) {
61 return 'copying' if $_[0] == &ACT_COPYING; 57 return 'copying' if $_[0] == &ACT_COPYING;
62 return 'decoding' if $_[0] == &ACT_DECODING; 58 return 'decoding' if $_[0] == &ACT_DECODING;
911; 871;
92__END__ 88__END__
93 89
94=head1 NAME 90=head1 NAME
95 91
96Convert::UUlib - Perl interface to the uulib library (a.k.a. uudeview/uuenview). 92Convert::UUlib - decode uu/xx/b64/mime/yenc/etc-encoded data from a massive number of files
97 93
98=head1 SYNOPSIS 94=head1 SYNOPSIS
99 95
100 use Convert::UUlib ':all'; 96 use Convert::UUlib ':all';
101 97
102 # read all the files named on the commandline and decode them 98 # read all the files named on the commandline and decode them
103 # into the CURRENT directory. See below for a longer example. 99 # into the CURRENT directory. See below for a longer example.
104 LoadFile $_ for @ARGV; 100 LoadFile $_ for @ARGV;
105 for (my $i = 0; my $uu = GetFileListItem $i; $i++) { 101
102 for my $uu (GetFileList) {
106 if ($uu->state & FILE_OK) { 103 if ($uu->state & FILE_OK) {
107 $uu->decode; 104 $uu->decode;
108 print $uu->filename, "\n"; 105 print $uu->filename, "\n";
109 } 106 }
110 } 107 }
111 108
112=head1 DESCRIPTION 109=head1 DESCRIPTION
110
111This module started as an interface to the uulib/uudeview library by Frank
112Pilhofer that can be used to decode all kinds of usenet (and other)
113binary messages.
114
115After upstream abondoned the project, the library was continuously bugfixed
116and improved in this module, with major focuses on security fixes,
117correctness and speed (that does not mean that this library is considered
118safe with untrusted data, but it surely is safer than the original
119uudeview).
113 120
114Read the file doc/library.pdf from the distribution for in-depth 121Read the file doc/library.pdf from the distribution for in-depth
115information about the C-library used in this interface, and the rest of 122information about the C-library used in this interface, and the rest of
116this document and especially the non-trivial decoder program at the end. 123this document and especially the non-trivial decoder program at the end.
117 124
137=head2 Options 144=head2 Options
138 145
139 OPT_VERSION version number MAJOR.MINORplPATCH (ro) 146 OPT_VERSION version number MAJOR.MINORplPATCH (ro)
140 OPT_FAST assumes only one part per file 147 OPT_FAST assumes only one part per file
141 OPT_DUMBNESS switch off the program's intelligence 148 OPT_DUMBNESS switch off the program's intelligence
142 OPT_BRACKPOL give numbers in [] higher precendence 149 OPT_BRACKPOL give numbers in [] higher precedence
143 OPT_VERBOSE generate informative messages 150 OPT_VERBOSE generate informative messages
144 OPT_DESPERATE try to decode incomplete files 151 OPT_DESPERATE try to decode incomplete files
145 OPT_IGNREPLY ignore RE:plies (off by default) 152 OPT_IGNREPLY ignore RE:plies (off by default)
146 OPT_OVERWRITE whether it's OK to overwrite ex. files 153 OPT_OVERWRITE whether it's OK to overwrite ex. files
147 OPT_SAVEPATH prefix to save-files on disk 154 OPT_SAVEPATH prefix to save-files on disk
154 OPT_TINYB64 detect short B64 outside of Mime 161 OPT_TINYB64 detect short B64 outside of Mime
155 OPT_ENCEXT extension for single-part encoded files 162 OPT_ENCEXT extension for single-part encoded files
156 OPT_REMOVE remove input files after decoding (dangerous) 163 OPT_REMOVE remove input files after decoding (dangerous)
157 OPT_MOREMIME strict MIME adherence 164 OPT_MOREMIME strict MIME adherence
158 OPT_DOTDOT ".."-unescaping has not yet been done on input files 165 OPT_DOTDOT ".."-unescaping has not yet been done on input files
166 OPT_RBUF set default read I/O buffer size in bytes
167 OPT_WBUF set default write I/O buffer size in bytes
168 OPT_AUTOCHECK automatically check file list after every loadfile
159 169
160=head2 Result/Error codes 170=head2 Result/Error codes
161 171
162 RET_OK everything went fine 172 RET_OK everything went fine
163 RET_IOERR I/O Error - examine errno 173 RET_IOERR I/O Error - examine errno
206again. 216again.
207 217
208On my machine, a fairly complete decode with DBI backend needs about 10MB 218On my machine, a fairly complete decode with DBI backend needs about 10MB
209RSS to decode 20000 files. 219RSS to decode 20000 files.
210 220
211=over 4 221=over
212
213=item Initialize
214
215Not normally necessary, (re-)initializes the library.
216 222
217=item CleanUp 223=item CleanUp
218 224
219Not normally necessary, could be called at the end to release memory 225Release memory, file items and clean up files. Should be called after a
220before starting a new decoding round. 226decoidng run, if you want to start a new one.
221 227
222=back 228=back
223 229
224=head2 Setting and querying options 230=head2 Setting and querying options
225 231
226=over 4 232=over
227 233
228=item $option = GetOption OPT_xxx 234=item $option = GetOption OPT_xxx
229 235
230=item SetOption OPT_xxx, opt-value 236=item SetOption OPT_xxx, opt-value
231 237
233 239
234See the C<OPT_xxx> constants above to see which options exist. 240See the C<OPT_xxx> constants above to see which options exist.
235 241
236=head2 Setting various callbacks 242=head2 Setting various callbacks
237 243
238=over 4 244=over
239 245
240=item SetMsgCallback [callback-function] 246=item SetMsgCallback [callback-function]
241 247
242=item SetBusyCallback [callback-function] 248=item SetBusyCallback [callback-function]
243 249
247 253
248=back 254=back
249 255
250=head2 Call the currently selected FNameFilter 256=head2 Call the currently selected FNameFilter
251 257
252=over 4 258=over
253 259
254=item $file = FNameFilter $file 260=item $file = FNameFilter $file
255 261
256=back 262=back
257 263
258=head2 Loading sourcefiles, optionally fuzzy merge and start decoding 264=head2 Loading sourcefiles, optionally fuzzy merge and start decoding
259 265
260=over 4 266=over
261 267
262=item ($retval, $count) = LoadFile $fname, [$id, [$delflag, [$partno]]] 268=item ($retval, $count) = LoadFile $fname, [$id, [$delflag, [$partno]]]
263 269
264Load the given file and scan it for encoded contents. Optionally tag it 270Load the given file and scan it for encoded contents. Optionally tag it
265with the given id, and if C<$delflag> is true, delete the file after it 271with the given id, and if C<$delflag> is true, delete the file after it
266is no longer necessary. If you are certain of the part number, you cna 272is no longer necessary. If you are certain of the part number, you can
267specify it as the lat argument. 273specify it as the last argument.
268 274
269A better (usually faster) way of doing this is using the C<SetFNameFilter> 275A better (usually faster) way of doing this is using the C<SetFNameFilter>
270functionality. 276functionality.
271 277
272=item $retval = Smerge $pass 278=item $retval = Smerge $pass
274If you are desperate, try to call C<Smerge> with increasing C<$pass> 280If you are desperate, try to call C<Smerge> with increasing C<$pass>
275values, beginning at C<0>, to try to merge parts that usually would not 281values, beginning at C<0>, to try to merge parts that usually would not
276have been merged. 282have been merged.
277 283
278Most probably this will result in garbled files, so never do this by 284Most probably this will result in garbled files, so never do this by
279default. 285default, except:
286
287If the C<OPT_AUTOCHECK> option has been disabled (by default it is
288enabled) to speed up file loading, then you I<have> to call C<Smerge -1>
289after loading all files as an additional pre-pass (which is normally done
290by C<LoadFile>).
280 291
281=item $item = GetFileListItem $item_number 292=item $item = GetFileListItem $item_number
282 293
283Return the C<$item> structure for the C<$item_number>'th found file, or 294Return the C<$item> structure for the C<$item_number>'th found file, or
284C<undef> of no file with that number exists. 295C<undef> of no file with that number exists.
285 296
286The first file has number C<0>, and the series has no holes, so you can 297The first file has number C<0>, and the series has no holes, so you can
287iterate over all files by starting with zero and incrementing until you 298iterate over all files by starting with zero and incrementing until you
288hit C<undef>. 299hit C<undef>.
289 300
301This function has to walk the linear list of fils on each access, so
302if you want to iterate over all items, it is usually faster to use
303C<GetFileList>.
304
305=item @items = GetFileList
306
307Similar to C<GetFileListItem>, but returns all files in one go, which is
308very much faster for large number of items, and has no drawbacks when used
309for a small number of items.
310
290=back 311=back
291 312
292=head2 Decoding files 313=head2 Decoding files
293 314
294=over 4 315=over
295 316
296=item $retval = $item->rename($newname) 317=item $retval = $item->rename ($newname)
297 318
298Change the ondisk filename where the decoded file will be saved. 319Change the ondisk filename where the decoded file will be saved.
299 320
300=item $retval = $item->decode_temp 321=item $retval = $item->decode_temp
301 322
304 325
305=item $retval = $item->remove_temp 326=item $retval = $item->remove_temp
306 327
307Remove the temporarily decoded file again. 328Remove the temporarily decoded file again.
308 329
309=item $retval = $item->decode([$target_path]) 330=item $retval = $item->decode ([$target_path])
310 331
311Decode the file to it's destination, or the given target path. 332Decode the file to its destination, or the given target path.
312 333
313=item $retval = $item->info(callback-function) 334=item $retval = $item->info (callback-function)
314 335
315=back 336=back
316 337
317=head2 Querying (and setting) item attributes 338=head2 Querying (and setting) item attributes
318 339
319=over 4 340=over
320 341
321=item $state = $item->state 342=item $state = $item->state
322 343
323=item $mode = $item->mode([newmode]) 344=item $mode = $item->mode ([newmode])
324 345
325=item $uudet = $item->uudet 346=item $uudet = $item->uudet
326 347
327=item $size = $item->size 348=item $size = $item->size
328 349
329=item $filename = $item->filename([newfilename}) 350=item $filename = $item->filename ([newfilename})
330 351
331=item $subfname = $item->subfname 352=item $subfname = $item->subfname
332 353
333=item $mimeid = $item->mimeid 354=item $mimeid = $item->mimeid
334 355
338 359
339=back 360=back
340 361
341=head2 Information about source parts 362=head2 Information about source parts
342 363
343=over 4 364=over
344 365
345=item $parts = $item->parts 366=item $parts = $item->parts
346 367
347Return information about all parts (source files) used to decode the file 368Return information about all parts (source files) used to decode the file
348as a list of hashrefs with the following structure: 369as a list of hashrefs with the following structure:
362Usually you are interested mostly the C<sfname> and possibly the C<partno> 383Usually you are interested mostly the C<sfname> and possibly the C<partno>
363and C<filename> members. 384and C<filename> members.
364 385
365=back 386=back
366 387
367=head2 Functions below not documented and not very well tested 388=head2 Functions below are not documented and not very well tested - feedback welcome
368 389
369 QuickDecode 390 QuickDecode
370 EncodeMulti 391 EncodeMulti
371 EncodePartial 392 EncodePartial
372 EncodeToStream 393 EncodeToStream
376 397
377=head2 EXTENSION FUNCTIONS 398=head2 EXTENSION FUNCTIONS
378 399
379Functions found in this module but not documented in the uulib documentation: 400Functions found in this module but not documented in the uulib documentation:
380 401
381=over 4 402=over
382 403
383=item $msg = straction ACT_xxx 404=item $msg = straction ACT_xxx
384 405
385Return a human readable string representing the given action code. 406Return a human readable string representing the given action code.
386 407
427 448
428=back 449=back
429 450
430=head1 LARGE EXAMPLE DECODER 451=head1 LARGE EXAMPLE DECODER
431 452
453The general workflow for decoding is like this:
454
455=over
456
457=item 1. Configure options with C<SetOption> or C<SetXXXCallback>.
458
459=item 2. Load all source files with C<LoadFile>.
460
461=item 3. Optionally C<Smerge>.
462
463=item 4. Iterate over all C<GetFileList> items (i.e. result files).
464
465=item 5. C<CleanUp> to delete files and free items.
466
467=back
468
432This is the file C<example-decoder> from the distribution, put here 469What follows is the file C<example-decoder> from the distribution that
433instead of more thorough documentation. 470illustrates the above worklfow in a non-trivial example.
434 471
472 #!/usr/bin/perl
473
435 # decode all the files in the directory uusrc/ and copy 474 # decode all the files in the directory uusrc/ and copy
436 # the resulting files to uudst/ 475 # the resulting files to uudst/
437 476
438 use Convert::UUlib ':all'; 477 use Convert::UUlib ':all';
439 478
440 sub namefilter { 479 sub namefilter {
441 my($path)=@_; 480 my ($path) = @_;
481
442 $path=~s/^.*[\/\\]//; 482 $path=~s/^.*[\/\\]//;
483
443 $path; 484 $path
444 } 485 }
445 486
446 sub busycb { 487 sub busycb {
447 my ($action, $curfile, $partno, $numparts, $percent, $fsize) = @_; 488 my ($action, $curfile, $partno, $numparts, $percent, $fsize) = @_;
448 $_[0]=straction($action); 489 $_[0]=straction($action);
449 print "busy_callback(", (join ",",@_), ")\n"; 490 print "busy_callback(", (join ",",@_), ")\n";
450 0; 491 0
451 } 492 }
452 493
494 SetOption OPT_RBUF, 128*1024;
495 SetOption OPT_WBUF, 1024*1024;
453 SetOption OPT_IGNMODE, 1; 496 SetOption OPT_IGNMODE, 1;
497 SetOption OPT_IGNMODE, 1;
454 SetOption OPT_VERBOSE, 1; 498 SetOption OPT_VERBOSE, 1;
499 SetOption OPT_AUTOCHK, 0;
455 500
456 # show the three ways you can set callback functions. I normally 501 # show the three ways you can set callback functions. I normally
457 # prefer the one with the sub inplace. 502 # prefer the one with the sub inplace.
458 SetFNameFilter \&namefilter; 503 SetFNameFilter \&namefilter;
459 504
460 SetBusyCallback "busycb", 333; 505 SetBusyCallback "busycb", 333;
461 506
462 SetMsgCallback sub { 507 SetMsgCallback sub {
463 my ($msg, $level) = @_; 508 my ($msg, $level) = @_;
464 print uc strmsglevel $_[1], ": $msg\n"; 509 print uc strmsglevel $_[1], ": $msg\n";
465 }; 510 };
466 511
467 # the following non-trivial FileNameCallback takes care 512 # the following non-trivial FileNameCallback takes care
468 # of some subject lines not detected properly by uulib: 513 # of some subject lines not detected properly by uulib:
469 SetFileNameCallback sub { 514 SetFileNameCallback sub {
470 return unless $_[1]; # skip "Re:"-plies et al. 515 return unless $_[1]; # skip "Re:"-plies et al.
471 local $_ = $_[0]; 516 local $_ = $_[0];
472 517
473 # the following rules are rather effective on some newsgroups, 518 # the following rules are rather effective on some newsgroups,
474 # like alt.binaries.games.anime, where non-mime, uuencoded data 519 # like alt.binaries.games.anime, where non-mime, uuencoded data
475 # is very common 520 # is very common
476 521
477 # if we find some *.rar, take it as the filename 522 # if we find some *.rar, take it as the filename
478 return $1 if /(\S{3,}\.(?:[rstuvwxyz]\d\d|rar))\s/i; 523 return $1 if /(\S{3,}\.(?:[rstuvwxyz]\d\d|rar))\s/i;
479 524
480 # one common subject format 525 # one common subject format
481 return $1 if /- "(.{2,}?\..+?)" (?:yenc )?\(\d+\/\d+\)/i; 526 return $1 if /- "(.{2,}?\..+?)" (?:yenc )?\(\d+\/\d+\)/i;
482 527
483 # - filename.par (04/55) 528 # - filename.par (04/55)
484 return $1 if /- "?(\S{3,}\.\S+?)"? (?:yenc )?\(\d+\/\d+\)/i; 529 return $1 if /- "?(\S{3,}\.\S+?)"? (?:yenc )?\(\d+\/\d+\)/i;
485 530
486 # - (xxx) No. 1 sayuri81.jpg 756565 bytes 531 # - (xxx) No. 1 sayuri81.jpg 756565 bytes
487 # - (20 files) No.17 Roseanne.jpg [2/2] 532 # - (20 files) No.17 Roseanne.jpg [2/2]
488 return $1 if /No\.[ 0-9]+ (\S+\....) (?:\d+ bytes )?\[/; 533 return $1 if /No\.[ 0-9]+ (\S+\....) (?:\d+ bytes )?\[/;
489 534
535 # try to detect some common forms of filenames
536 return $1 if /([a-z0-9_\-+.]{3,}\.[a-z]{3,4}(?:.\d+))/i;
537
490 # otherwise just pass what we have 538 # otherwise just pass what we have
491 return (); 539 ()
492 }; 540 };
493 541
494 # now read all files in the directory uusrc/* 542 # now read all files in the directory uusrc/*
495 for(<uusrc/*>) { 543 for (<uusrc/*>) {
496 my($retval,$count)=LoadFile ($_, $_, 1); 544 my ($retval, $count) = LoadFile ($_, $_, 1);
497 print "file($_), status(", strerror $retval, ") parts($count)\n"; 545 print "file($_), status(", strerror $retval, ") parts($count)\n";
498 } 546 }
499 547
548 Smerge -1;
549
500 SetOption OPT_SAVEPATH, "uudst/"; 550 SetOption OPT_SAVEPATH, "uudst/";
501 551
502 # now wade through all files and their source parts 552 # now wade through all files and their source parts
503 $i = 0; 553 for my $uu (GetFileList) {
504 while ($uu = GetFileListItem($i)) { 554 print "file ", $uu->filename, "\n";
505 $i++;
506 print "file nr. $i";
507 print " state ", $uu->state; 555 print " state ", $uu->state, "\n";
508 print " mode ", $uu->mode; 556 print " mode ", $uu->mode, "\n";
509 print " uudet ", strencoding $uu->uudet; 557 print " uudet ", strencoding $uu->uudet, "\n";
510 print " size ", $uu->size; 558 print " size ", $uu->size, "\n";
511 print " filename ", $uu->filename;
512 print " subfname ", $uu->subfname; 559 print " subfname ", $uu->subfname, "\n";
513 print " mimeid ", $uu->mimeid; 560 print " mimeid ", $uu->mimeid, "\n";
514 print " mimetype ", $uu->mimetype; 561 print " mimetype ", $uu->mimetype, "\n";
515 print "\n";
516 562
517 # print additional info about all parts 563 # print additional info about all parts
564 print " parts";
518 for ($uu->parts) { 565 for ($uu->parts) {
519 while (my ($k, $v) = each %$_) { 566 for my $k (sort keys %$_) {
520 print "$k > $v, "; 567 print " $k=$_->{$k}";
521 } 568 }
522 print "\n"; 569 print "\n";
523 } 570 }
524 571
525 $uu->decode_temp;
526 print " temporarily decoded to ", $uu->binfile, "\n";
527 $uu->remove_temp; 572 $uu->remove_temp;
528 573
529 print strerror $uu->decode; 574 if (my $err = $uu->decode) {
575 print " ERROR ", strerror $err, "\n";
576 } else {
530 print " saved as uudst/", $uu->filename, "\n"; 577 print " successfully saved as uudst/", $uu->filename, "\n";
531 } 578 }
579 }
532 580
533 print "cleanup...\n"; 581 print "cleanup...\n";
534 582
535 CleanUp(); 583 CleanUp;
584
585=head1 PERLMULTICORE SUPPORT
586
587This module supports the perlmulticore standard (see
588L<http://perlmulticore.schmorp.de/> for more info) for the following
589functions - generally these are functions accessing the disk and/or using
590considerable CPU time:
591
592 LoadFile
593 $item->decode
594 $item->decode_temp
595 $item->remove_temp
596 $item->info
597
598The perl interpreter will be reacquired/released on every callback
599invocation, so for performance reasons, callbacks should be avoided if
600that is costly.
601
602Future versions might enable multicore support for more functions.
603
604=head1 BUGS AND LIMITATIONS
605
606The original uulib library this module uses was written at a time where
607main memory was measured in megabytes and buffer overflows as a security
608thing didn't exist. While a lot of security fixes have been applied over
609the years (including some defense in depth mechanism that can shield
610against a lot of as-of-yet undetected bugs), using this library for
611security purposes requires care.
612
613Likewise, file sizes when the uulib library was written were tiny compared
614to today, so do not expect this library to handle files larger than 2GB,
615certainly not on a 32 bit host.
616
617Lastly, this module uses a very "C-like" interface, which means it doesn't
618protect you from invalid pointers as you might expect from "more perlish"
619modules - for example, accessing a file item object after calling
620C<CleanUp> will likely result in crashes, memory corruption, or worse.
536 621
537=head1 AUTHOR 622=head1 AUTHOR
538 623
539Marc Lehmann <pcg@goof.com>, the original uulib library was written 624Marc Lehmann <schmorp@schmorp.de>, the original uulib library was written
540by Frank Pilhofer <fp@informatik.uni-frankfurt.de>, and later heavily 625by Frank Pilhofer <fp@informatik.uni-frankfurt.de>, and later heavily
541bugfixed by Marc Lehmann. 626bugfixed by Marc Lehmann.
542 627
543=head1 SEE ALSO 628=head1 SEE ALSO
544 629
545perl(1), uudeview homepage at http://www.uni-frankfurt.de/~fp/uudeview/. 630perl(1), uudeview homepage at L<http://www.fpx.de/fp/Software/UUDeview/>.
546 631
547=cut 632=cut
633

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines