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.48 by root, Fri Feb 28 17:19:02 2020 UTC vs.
Revision 1.54 by root, Sat Dec 12 10:48:39 2020 UTC

1package Convert::UUlib; 1package Convert::UUlib;
2 2
3no warnings; 3use common::sense;
4use strict;
5 4
6use Carp; 5use Carp;
7 6
8require Exporter; 7require Exporter;
9require DynaLoader; 8require DynaLoader;
10 9
11our $VERSION = 1.62; 10our $VERSION = 1.71;
12 11
13our @ISA = qw(Exporter DynaLoader); 12our @ISA = qw(Exporter DynaLoader);
14 13
15our @_consts = qw( 14our @_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
51bootstrap Convert::UUlib $VERSION; 50bootstrap 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
54sub Initialize { } 53sub Initialize { }
55
56for (@_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
63sub straction($) { 56sub 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;
299if you want to iterate over all items, it is usually faster to use 292if you want to iterate over all items, it is usually faster to use
300C<GetFileList>. 293C<GetFileList>.
301 294
302=item @items = GetFileList 295=item @items = GetFileList
303 296
304Similar to C<GetFileListItem>, but returns all files in one go. 297Similar to C<GetFileListItem>, but returns all files in one go, which is
298very much faster for large number of items, and has no drawbacks when used
299for a small number of items.
305 300
306=back 301=back
307 302
308=head2 Decoding files 303=head2 Decoding files
309 304
489 SetOption OPT_RBUF, 128*1024; 484 SetOption OPT_RBUF, 128*1024;
490 SetOption OPT_WBUF, 1024*1024; 485 SetOption OPT_WBUF, 1024*1024;
491 SetOption OPT_IGNMODE, 1; 486 SetOption OPT_IGNMODE, 1;
492 SetOption OPT_IGNMODE, 1; 487 SetOption OPT_IGNMODE, 1;
493 SetOption OPT_VERBOSE, 1; 488 SetOption OPT_VERBOSE, 1;
489 SetOption OPT_AUTOCHK, 0;
494 490
495 # show the three ways you can set callback functions. I normally 491 # show the three ways you can set callback functions. I normally
496 # prefer the one with the sub inplace. 492 # prefer the one with the sub inplace.
497 SetFNameFilter \&namefilter; 493 SetFNameFilter \&namefilter;
498 494
536 # now read all files in the directory uusrc/* 532 # now read all files in the directory uusrc/*
537 for (<uusrc/*>) { 533 for (<uusrc/*>) {
538 my ($retval, $count) = LoadFile ($_, $_, 1); 534 my ($retval, $count) = LoadFile ($_, $_, 1);
539 print "file($_), status(", strerror $retval, ") parts($count)\n"; 535 print "file($_), status(", strerror $retval, ") parts($count)\n";
540 } 536 }
537
538 Smerge -1;
541 539
542 SetOption OPT_SAVEPATH, "uudst/"; 540 SetOption OPT_SAVEPATH, "uudst/";
543 541
544 # now wade through all files and their source parts 542 # now wade through all files and their source parts
545 for my $uu (GetFileList) { 543 for my $uu (GetFileList) {
603security purposes requires care. 601security purposes requires care.
604 602
605Likewise, file sizes when the uulib library was written were tiny compared 603Likewise, file sizes when the uulib library was written were tiny compared
606to today, so do not expect this library to handle files larger than 2GB. 604to today, so do not expect this library to handle files larger than 2GB.
607 605
606Lastly, this module uses a very "C-like" interface, which means it doesn't
607protect you from invalid points as you might expect from "more perlish"
608modules - for example, accessing a file item object after callinbg
609C<CleanUp> will likely result in crashes, memory corruption, or worse.
610
608=head1 AUTHOR 611=head1 AUTHOR
609 612
610Marc Lehmann <schmorp@schmorp.de>, the original uulib library was written 613Marc Lehmann <schmorp@schmorp.de>, the original uulib library was written
611by Frank Pilhofer <fp@informatik.uni-frankfurt.de>, and later heavily 614by Frank Pilhofer <fp@informatik.uni-frankfurt.de>, and later heavily
612bugfixed by Marc Lehmann. 615bugfixed by Marc Lehmann.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines