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.47 by root, Fri Feb 28 16:57:25 2020 UTC vs.
Revision 1.48 by root, Fri Feb 28 17:19:02 2020 UTC

48our @EXPORT_OK = @_funcs; 48our @EXPORT_OK = @_funcs;
49our %EXPORT_TAGS = (all => [@_consts,@_funcs], constants => \@_consts); 49our %EXPORT_TAGS = (all => [@_consts,@_funcs], constants => \@_consts);
50 50
51bootstrap Convert::UUlib $VERSION; 51bootstrap Convert::UUlib $VERSION;
52 52
53Initialize(); 53# dummy function for compatiiblity with pre-1.7 versions
54 54sub Initialize { }
55# not when < 5.005_6x
56# END { CleanUp() }
57 55
58for (@_consts) { 56for (@_consts) {
59 my $constant = constant($_); 57 my $constant = constant ($_);
60 no strict 'refs'; 58 no strict 'refs';
61 *$_ = sub () { $constant }; 59 *$_ = sub () { $constant };
62} 60}
63 61
64# action code -> string mapping 62# action code -> string mapping
105 use Convert::UUlib ':all'; 103 use Convert::UUlib ':all';
106 104
107 # read all the files named on the commandline and decode them 105 # read all the files named on the commandline and decode them
108 # into the CURRENT directory. See below for a longer example. 106 # into the CURRENT directory. See below for a longer example.
109 LoadFile $_ for @ARGV; 107 LoadFile $_ for @ARGV;
108
110 for my $uu (GetFileList) { 109 for my $uu (GetFileList) {
111 if ($uu->state & FILE_OK) { 110 if ($uu->state & FILE_OK) {
112 $uu->decode; 111 $uu->decode;
113 print $uu->filename, "\n"; 112 print $uu->filename, "\n";
114 } 113 }
216On my machine, a fairly complete decode with DBI backend needs about 10MB 215On my machine, a fairly complete decode with DBI backend needs about 10MB
217RSS to decode 20000 files. 216RSS to decode 20000 files.
218 217
219=over 218=over
220 219
221=item Initialize
222
223Not normally necessary, (re-)initializes the library.
224
225=item CleanUp 220=item CleanUp
226 221
227Not normally necessary, could be called at the end to release memory 222Release memory, file items and clean up files. Should be called after a
228before starting a new decoding round. 223decoidng run, if you want to start a new one.
229 224
230=back 225=back
231 226
232=head2 Setting and querying options 227=head2 Setting and querying options
233 228
448 443
449=back 444=back
450 445
451=head1 LARGE EXAMPLE DECODER 446=head1 LARGE EXAMPLE DECODER
452 447
448The general workflow for decoding is like this:
449
450=over
451
452=item 1. Configure options with C<SetOption> or C<SetXXXCallback>.
453
454=item 2. Load all source files with C<LoadFile>.
455
456=item 3. Optionally C<Smerge>.
457
458=item 4. Iterate over all C<GetFileList> items (i.e. result files).
459
460=item 5. C<CleanUp> to delete files and free items.
461
462=back
463
453This is the file C<example-decoder> from the distribution, put here 464What follows is the file C<example-decoder> from the distribution that
454instead of more thorough documentation. 465illustrates the above worklfow in a non-trivial example.
455 466
456 #!/usr/bin/perl 467 #!/usr/bin/perl
457 468
458 # decode all the files in the directory uusrc/ and copy 469 # decode all the files in the directory uusrc/ and copy
459 # the resulting files to uudst/ 470 # the resulting files to uudst/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines