Convert::yEnc decodes yEncoded files and writes them to disk. File parts are saved to $tmpDir; when all parts of a file have been received, the completed file is moved to $outDir.

Convert::yEnc maintains a database of partially received files, called the RC database. The RC database is loaded from disk when a Convert::yEnc object is created, and saved to disk when the object is DESTROY'd.

Creates and returns a new Convert::yEnc object. $rcFile contains the RC database. $outDir is the output directory, and $tmpDir is the temporary directory,

If the RC parameter is omitted, it defaults to $ENV{HOME}/.yencrc. If the out parameter is omitted, it defaults to the current working directory. If the tmp parameter is omitted, it defaults to the out parameter.

Convert::yEnc provides a DESTROY method as a convenience: you can create a yEnc object, use it, forget about it

my $yEnc = new Convert::yEnc;
$yEnc->decode(...);

and the RC file will automatically be written when the object ref count goes to zero.

Unless the ref count never goes to zero, because, for example, a named closure is holding a reference on the object

sub A { $yEnc }

In this case, the object won't be destructed until global destruct time. Unfortunately, the order in which objects are destructed during global destruction isn't controlled, and if the embedded $yEnc->RC object is destructed before $yEnc itself, then $yEnc->DESTROY won't be able to write the RC file.

To avoid creating closures, pass yEnc objects as parameters

my $yEnc = new Convert::yEnc;
A($yEnc);
sub A { my $yEnc = shift }

rather than referencing them as globals. To pass a yEnc object to a File::Findwanted routine, use an anonymous closure

File::Find::find(sub { A($yEnc) }, $dir)

It isn't always obvious when a closure is created; if you're feeling paranoid, write