Convert::yEnc::Decoder - decodes yEncoded files
use Convert::yEnc::Decoder; $decoder = new Convert::yEnc::Decoder; $decoder = new Convert::yEnc::Decoder $dir; $decoder->out_dir($dir); eval { $decoder->decode( $file); $decoder->decode(\*FILE); $decoder->decode; }; print $@ if $@; $name = $decoder->name; $file = $decoder->file; $size = $decoder->size; $ybegin = $decoder->ybegin; $ypart = $decoder->ypart; $yend = $decoder->yend;
yEnc decoder
Convert::yEnc::Decoder decodes a yEncoded file and writes it to disk. Methods are provided for returning information about the decoded file.
Convert::yEnc::Decoder
Nothing.
new
Creates and returns a new Convert::yEnc::Decoder object.
Decoded files will be written to $dir. If $dir is omitted, it defaults to the current working directory.
out_dir
Sets the output directory to $dir.
decode
Decodes a file. dies if there are any errors.
die
The first form reads from the file named $file. The second form reads from the file handle FILE. The third form reads from STDIN.
STDIN
The data stream need not begin at the =yBegin line; decode will search until it finds it. decode stops reading when it finds the =yend line, so Decoder can decode multiple files from the same data stream.
=yBegin
=yend
Decoder
decode may be called repeatedly on the same Decoder object to decode multiple files.
name
After a successful decode, returns the name of the file that was created.
file
After a successful decode, returns the complete path of the file that was created.
size
After a successful decode, returns the size of the decoded file.
ybegin
After a successful decode, returns the =ybegin line.
=ybegin
ypart
After a successful decode, returns the =ypart line, or undef if there wasn't one.
=ypart
yend
After a successful decode, returns the =yend line.
To decode a single file on the command line, write
perl -MConvert::yEnc::Decoder -e 'Convert::yEnc::Decoder->new->decode' < myFile
CRCs
Convert::yEnc
http://www.yenc.org
http://www.yenc.org/yenc-draft.1.3.txt
Steven W McDougall, <swmcd@world.std.com>
Copyright (c) 2002-2008 by Steven McDougall. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Convert::yEnc, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Convert::yEnc
CPAN shell
perl -MCPAN -e shell install Convert::yEnc
For more information on module installation, please visit the detailed CPAN module installation guide.