1 | package Convert::UUlib; |
1 | package Convert::UUlib; |
2 | |
2 | |
3 | no warnings; |
3 | use common::sense; |
4 | use strict; |
|
|
5 | |
4 | |
6 | use Carp; |
5 | use Carp; |
7 | |
6 | |
8 | require Exporter; |
7 | require Exporter; |
9 | require DynaLoader; |
8 | require DynaLoader; |
10 | |
9 | |
11 | our $VERSION = 1.62; |
10 | our $VERSION = 1.71; |
12 | |
11 | |
13 | our @ISA = qw(Exporter DynaLoader); |
12 | our @ISA = qw(Exporter DynaLoader); |
14 | |
13 | |
15 | our @_consts = qw( |
14 | our @_consts = qw( |
16 | ACT_COPYING ACT_DECODING ACT_ENCODING ACT_IDLE ACT_SCANNING |
15 | ACT_COPYING ACT_DECODING ACT_ENCODING ACT_IDLE ACT_SCANNING |
… | |
… | |
50 | |
49 | |
51 | bootstrap Convert::UUlib $VERSION; |
50 | bootstrap Convert::UUlib $VERSION; |
52 | |
51 | |
53 | # dummy function for compatiiblity with pre-1.7 versions |
52 | # dummy function for compatiiblity with pre-1.7 versions |
54 | sub Initialize { } |
53 | sub Initialize { } |
55 | |
|
|
56 | for (@_consts) { |
|
|
57 | my $constant = constant ($_); |
|
|
58 | no strict 'refs'; |
|
|
59 | *$_ = sub () { $constant }; |
|
|
60 | } |
|
|
61 | |
54 | |
62 | # action code -> string mapping |
55 | # action code -> string mapping |
63 | sub straction($) { |
56 | sub straction($) { |
64 | return 'copying' if $_[0] == &ACT_COPYING; |
57 | return 'copying' if $_[0] == &ACT_COPYING; |
65 | return 'decoding' if $_[0] == &ACT_DECODING; |
58 | return 'decoding' if $_[0] == &ACT_DECODING; |
… | |
… | |
489 | SetOption OPT_RBUF, 128*1024; |
482 | SetOption OPT_RBUF, 128*1024; |
490 | SetOption OPT_WBUF, 1024*1024; |
483 | SetOption OPT_WBUF, 1024*1024; |
491 | SetOption OPT_IGNMODE, 1; |
484 | SetOption OPT_IGNMODE, 1; |
492 | SetOption OPT_IGNMODE, 1; |
485 | SetOption OPT_IGNMODE, 1; |
493 | SetOption OPT_VERBOSE, 1; |
486 | SetOption OPT_VERBOSE, 1; |
|
|
487 | SetOption OPT_AUTOCHK, 0; |
494 | |
488 | |
495 | # show the three ways you can set callback functions. I normally |
489 | # show the three ways you can set callback functions. I normally |
496 | # prefer the one with the sub inplace. |
490 | # prefer the one with the sub inplace. |
497 | SetFNameFilter \&namefilter; |
491 | SetFNameFilter \&namefilter; |
498 | |
492 | |
… | |
… | |
536 | # now read all files in the directory uusrc/* |
530 | # now read all files in the directory uusrc/* |
537 | for (<uusrc/*>) { |
531 | for (<uusrc/*>) { |
538 | my ($retval, $count) = LoadFile ($_, $_, 1); |
532 | my ($retval, $count) = LoadFile ($_, $_, 1); |
539 | print "file($_), status(", strerror $retval, ") parts($count)\n"; |
533 | print "file($_), status(", strerror $retval, ") parts($count)\n"; |
540 | } |
534 | } |
|
|
535 | |
|
|
536 | Smerge -1; |
541 | |
537 | |
542 | SetOption OPT_SAVEPATH, "uudst/"; |
538 | SetOption OPT_SAVEPATH, "uudst/"; |
543 | |
539 | |
544 | # now wade through all files and their source parts |
540 | # now wade through all files and their source parts |
545 | for my $uu (GetFileList) { |
541 | for my $uu (GetFileList) { |
… | |
… | |
603 | security purposes requires care. |
599 | security purposes requires care. |
604 | |
600 | |
605 | Likewise, file sizes when the uulib library was written were tiny compared |
601 | Likewise, file sizes when the uulib library was written were tiny compared |
606 | to today, so do not expect this library to handle files larger than 2GB. |
602 | to today, so do not expect this library to handle files larger than 2GB. |
607 | |
603 | |
|
|
604 | Lastly, this module uses a very "C-like" interface, which means it doesn't |
|
|
605 | protect you from invalid points as you might expect from "more perlish" |
|
|
606 | modules - for example, accessing a file item object after callinbg |
|
|
607 | C<CleanUp> will likely result in crashes, memory corruption, or worse. |
|
|
608 | |
608 | =head1 AUTHOR |
609 | =head1 AUTHOR |
609 | |
610 | |
610 | Marc Lehmann <schmorp@schmorp.de>, the original uulib library was written |
611 | Marc Lehmann <schmorp@schmorp.de>, the original uulib library was written |
611 | by Frank Pilhofer <fp@informatik.uni-frankfurt.de>, and later heavily |
612 | by Frank Pilhofer <fp@informatik.uni-frankfurt.de>, and later heavily |
612 | bugfixed by Marc Lehmann. |
613 | bugfixed by Marc Lehmann. |