… | |
… | |
5 | use Carp; |
5 | use Carp; |
6 | |
6 | |
7 | require Exporter; |
7 | require Exporter; |
8 | require DynaLoader; |
8 | require DynaLoader; |
9 | |
9 | |
10 | our $VERSION = 1.7; |
10 | our $VERSION = 1.8; |
11 | |
11 | |
12 | our @ISA = qw(Exporter DynaLoader); |
12 | our @ISA = qw(Exporter DynaLoader); |
13 | |
13 | |
14 | our @_consts = qw( |
14 | our @_consts = qw( |
15 | ACT_COPYING ACT_DECODING ACT_ENCODING ACT_IDLE ACT_SCANNING |
15 | ACT_COPYING ACT_DECODING ACT_ENCODING ACT_IDLE ACT_SCANNING |
… | |
… | |
87 | 1; |
87 | 1; |
88 | __END__ |
88 | __END__ |
89 | |
89 | |
90 | =head1 NAME |
90 | =head1 NAME |
91 | |
91 | |
92 | Convert::UUlib - Perl interface to the uulib library (a.k.a. uudeview/uuenview). |
92 | Convert::UUlib - decode uu/xx/b64/mime/yenc/etc-encoded data from a massive number of files |
93 | |
93 | |
94 | =head1 SYNOPSIS |
94 | =head1 SYNOPSIS |
95 | |
95 | |
96 | use Convert::UUlib ':all'; |
96 | use Convert::UUlib ':all'; |
97 | |
97 | |
… | |
… | |
105 | print $uu->filename, "\n"; |
105 | print $uu->filename, "\n"; |
106 | } |
106 | } |
107 | } |
107 | } |
108 | |
108 | |
109 | =head1 DESCRIPTION |
109 | =head1 DESCRIPTION |
|
|
110 | |
|
|
111 | This module started as an interface to the uulib/uudeview library by Frank |
|
|
112 | Pilhofer that can be used to decode all kinds of usenet (and other) |
|
|
113 | binary messages. |
|
|
114 | |
|
|
115 | After upstream abondoned the project, th library was continuously bugfixed |
|
|
116 | and improved in this module, with major focuses on security fixes, |
|
|
117 | correctness and speed (that does not mean that this library is considered |
|
|
118 | safe with untrusted data, but it surely is safer than the poriginal |
|
|
119 | uudeview). |
110 | |
120 | |
111 | Read the file doc/library.pdf from the distribution for in-depth |
121 | Read the file doc/library.pdf from the distribution for in-depth |
112 | information about the C-library used in this interface, and the rest of |
122 | information about the C-library used in this interface, and the rest of |
113 | this document and especially the non-trivial decoder program at the end. |
123 | this document and especially the non-trivial decoder program at the end. |
114 | |
124 | |
… | |
… | |
292 | if you want to iterate over all items, it is usually faster to use |
302 | if you want to iterate over all items, it is usually faster to use |
293 | C<GetFileList>. |
303 | C<GetFileList>. |
294 | |
304 | |
295 | =item @items = GetFileList |
305 | =item @items = GetFileList |
296 | |
306 | |
297 | Similar to C<GetFileListItem>, but returns all files in one go. |
307 | Similar to C<GetFileListItem>, but returns all files in one go, which is |
|
|
308 | very much faster for large number of items, and has no drawbacks when used |
|
|
309 | for a small number of items. |
298 | |
310 | |
299 | =back |
311 | =back |
300 | |
312 | |
301 | =head2 Decoding files |
313 | =head2 Decoding files |
302 | |
314 | |
… | |
… | |
482 | SetOption OPT_RBUF, 128*1024; |
494 | SetOption OPT_RBUF, 128*1024; |
483 | SetOption OPT_WBUF, 1024*1024; |
495 | SetOption OPT_WBUF, 1024*1024; |
484 | SetOption OPT_IGNMODE, 1; |
496 | SetOption OPT_IGNMODE, 1; |
485 | SetOption OPT_IGNMODE, 1; |
497 | SetOption OPT_IGNMODE, 1; |
486 | SetOption OPT_VERBOSE, 1; |
498 | SetOption OPT_VERBOSE, 1; |
|
|
499 | SetOption OPT_AUTOCHK, 0; |
487 | |
500 | |
488 | # show the three ways you can set callback functions. I normally |
501 | # show the three ways you can set callback functions. I normally |
489 | # prefer the one with the sub inplace. |
502 | # prefer the one with the sub inplace. |
490 | SetFNameFilter \&namefilter; |
503 | SetFNameFilter \&namefilter; |
491 | |
504 | |
… | |
… | |
529 | # now read all files in the directory uusrc/* |
542 | # now read all files in the directory uusrc/* |
530 | for (<uusrc/*>) { |
543 | for (<uusrc/*>) { |
531 | my ($retval, $count) = LoadFile ($_, $_, 1); |
544 | my ($retval, $count) = LoadFile ($_, $_, 1); |
532 | print "file($_), status(", strerror $retval, ") parts($count)\n"; |
545 | print "file($_), status(", strerror $retval, ") parts($count)\n"; |
533 | } |
546 | } |
|
|
547 | |
|
|
548 | Smerge -1; |
534 | |
549 | |
535 | SetOption OPT_SAVEPATH, "uudst/"; |
550 | SetOption OPT_SAVEPATH, "uudst/"; |
536 | |
551 | |
537 | # now wade through all files and their source parts |
552 | # now wade through all files and their source parts |
538 | for my $uu (GetFileList) { |
553 | for my $uu (GetFileList) { |
… | |
… | |
594 | the years (includign some defense in depth mechanism that can shield |
609 | the years (includign some defense in depth mechanism that can shield |
595 | against a lot of as-of-yet undetected bugs), using this library for |
610 | against a lot of as-of-yet undetected bugs), using this library for |
596 | security purposes requires care. |
611 | security purposes requires care. |
597 | |
612 | |
598 | Likewise, file sizes when the uulib library was written were tiny compared |
613 | Likewise, file sizes when the uulib library was written were tiny compared |
599 | to today, so do not expect this library to handle files larger than 2GB. |
614 | to today, so do not expect this library to handle files larger than 2GB, |
|
|
615 | certainly not on a 32 bit host. |
600 | |
616 | |
601 | Lastly, this module uses a very "C-like" interface, which means it doesn't |
617 | Lastly, this module uses a very "C-like" interface, which means it doesn't |
602 | protect you from invalid points as you might expect from "more perlish" |
618 | protect you from invalid pointers as you might expect from "more perlish" |
603 | modules - for example, accessing a file item object after callinbg |
619 | modules - for example, accessing a file item object after calling |
604 | C<CleanUp> will likely result in crashes, memory corruption, or worse. |
620 | C<CleanUp> will likely result in crashes, memory corruption, or worse. |
605 | |
621 | |
606 | =head1 AUTHOR |
622 | =head1 AUTHOR |
607 | |
623 | |
608 | Marc Lehmann <schmorp@schmorp.de>, the original uulib library was written |
624 | Marc Lehmann <schmorp@schmorp.de>, the original uulib library was written |