Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ebook::tools::lzss(3pm) [debian man page]

EBook::Tools::LZSS(3pm) 				User Contributed Perl Documentation				   EBook::Tools::LZSS(3pm)

NAME
EBook::Tools::LZSS - Lempel-Ziv-Storer-Szymanski compression and decompression SYNOPSIS
use EBook::Tools::LZSS; my $lzss = EBook::Tools::LZSS->new(lengthbits => 3, offsetbits => 14, windowinit => 'the man'); my $textref = $lzss->uncompress($data); CONSTRUCTOR AND INITIALIZATION
"new(%args)" Instantiates a new EBook::Tools::LZSS object. Arguments All arguments are optional, but must be identical between compression and decompression for the result to be valid. o "lengthbits" The number of bits used to encode the length of a LZSS reference. If not specified defaults to 4 bits. The eBookwise .IMP format typically compresses with 3 length bits. Note that the actual length of the LZSS reference in bytes is greater than the value stored in the length bits. The actual number of bytes returned is the decoded length bits value plus "maxuncoded" plus 1, o "offsetbits" The number of bits used to encode the offset to a LZSS reference. This also determines the size of the sliding window of reference data. If not specified, it defaults to 12 bits (4096-byte window). The eBookwise .IMP format typically compresses with 14 offset bits (16384-byte window). o "windowinit" A string used to initalize the sliding window. If specified, this string MUST be the same length as the window size, or the subroutine will croak. If not specified, the window will be initialized with spaces. o "windowstart" The first byte position in the window that will be overwritten by decoded text. If not specified, defaults to 0. o "maxuncoded" The maximum number of uncoded bytes (?). This currently isn't used for that purpose, but determines the actual length of a LZSS reference. o "screwybits" If set to true and the number of offset bits is greater than 8, then the offset bits will be read first in a chunk of 8 for the least significant bits, and then the remaining bits will be read and use as the most significant bits. This seems to be necessary for compatibility with Michael Dipperstein's LZSS C compression library but does not hold true for IMP e-book LZSS decompression. o "verbose" If set to true, compression and uncompression will provide additional status feedback on STDOUT. METHODS
"uncompress($dataref)" Takes a reference to a compressed data string, uncompresses the data string and returns a reference to the uncompressed string. BUGS AND LIMITATIONS
o Compression not yet implemented. o The LZSS algorithm isn't documented in the POD. o Once compression is implemented and the algorithm is documented, this module is a good candidate for being forked off into its own project. Relying on it to keep its current name may be unwise. AUTHOR
Zed Pobre <zed@debian.org> The design of this module was based on the C LZSS library by Michael Dipperstein, version 0.5.2, at http://michael.dipperstein.com/lzss/ LICENSE AND COPYRIGHT
Copyright 2008 Zed Pobre Licensed to the public under the terms of the GNU GPL, version 2. perl v5.10.1 2012-01-05 EBook::Tools::LZSS(3pm)

Check Out this Related Man Page

EBook::Tools::Unpack(3pm)				User Contributed Perl Documentation				 EBook::Tools::Unpack(3pm)

NAME
EBook::Tools::Unpack - Object class for unpacking e-book files into their component parts and metadata SYNOPSIS
use EBook::Tools::Unpack; my $unpacker = EBook::Tools::Unpack->new( 'file' => $filename, 'dir' => $dir, 'encoding' => $encoding, 'format' => $format, 'raw' => $raw, 'author' => $author, 'title' => $title, 'opffile' => $opffile, 'tidy' => $tidy, 'nosave' => $nosave, ); $unpacker->unpack; or, more simply: use EBook::Tools::Unpack; my $unpacker = EBook::Tools::Unpack->new('file' => 'mybook.prc'); $unpacker->unpack; CONSTRUCTOR
"new(%args)" Instantiates a new Ebook::Tools::Unpack object. Arguments o "file" The file to unpack. Specifying this is mandatory. o "dir" The directory to unpack into. If not specified, defaults to the basename of the file. o "encoding" If specified, overrides the encoding to use when unpacking. This is normally detected from the file and does not need to be specified. Valid values are '1252' (specifying Windows-1252) and '65001' (specifying UTF-8). o "htmlconvert" If set to true, an attempt will be made to convert non-HTML output text to HTML where possible. o "key" The decryption key to use if necessary (not yet implemented) o "keyfile" The file holding the decryption keys to use if necessary (not yet implemented) o "language" If specified, overrides the detected language information. o "opffile" The name of the file in which the metadata will be stored. If not specified, defaults to the value of "dir" with ".opf" appended. o "raw" If set true, this forces no corrections to be done on any extracted text and a lot of raw, unparsed, unmodified data to be dumped into the directory along with everything else. It's useful for debugging exactly what was in the file being unpacked, and (when combined with "nosave") reducing the time needed to extract parsed data from an ebook container without actually unpacking it. o "author" Overrides the detected author name. o "title" Overrides the detected title. o "tidy" If set to true, the unpacker will run tidy on any HTML output files to convert them to valid XHTML. Be warned that this can occasionally change the formatting, as Tidy isn't very forgiving on certain common tricks (such as empty <pre> elements with style elements) that abuse the standard. o "nosave" If set to true, the unpacker will run through all of the unpacking steps except those that actually write to the disk. This is useful for testing, but also (particularly when combined with "raw") can be used for extracting parsed data from an ebook container without actually unpacking it. ACCESSOR METHODS
See "new()" for more details on what some of these mean. Note that some values cannot be autodetected until an unpack method executes. "author" "dir" "file" "filebase" In scalar context, this is the basename of "file". In list context, it actually returns the basename, directory, and extension as per "fileparse" from File::Basename. "format" "key" "keyfile" "language" This returns the language specified by the user, if any. It remains undefined if the user has not requested that a language code be set even if a language was autodetected. "opffile" "raw" "title" This returns the title specified by the user, if any. It remains undefined if the user has not requested a title be set even if a title was autodetected. "detected" This returns a hash containing the autodetected metadata, if any. MODIFIER METHODS
"detect_format()" Attempts to automatically detect the format of the input file and set the internal object attributes "$self->{format}" and "$self->{formatinfo}", where the former is a one-word string used by the dispatcher to select the correct unpacking method and the latter may contain additional detected information (such as a title or version). Croaks if detection fails. In scalar context, returns "$self->{format}". In list context, returns the two element list "($self->{format},$self->{formatinfo})" This is automatically called by "new()" if the "format" argument is not specified. "detect_from_mobi_exth()" Detects metadata values from the MOBI EXTH headers retrieved via "unpack_mobi_exth()" and places them into the "detected" attribute. "gen_opf(%args)" This generates an OPF file from detected and specified metadata. It does not honor the "nosave" flag, and will always write its output. Normally this is called automatically from inside the "unpack" methods, but can be called manually after an unpack if the "nosave" flag was set to write an OPF anyway. Returns the filename of the OPF file. Arguments o "opffile" (optional) If specified, this overrides the object attribute "opffile", and determines the filename to use for the generated OPF file. If not specified, and the object attribute "opffile" has somehow been cleared (the attribute is set during "new()"), it will be generated by looking at the "textfile" argument. If no value can be found, the method croaks. If a value was found somewhere other than the object attribute "opffile", then the object attribute is updated to match. o "textfile" (optional) The file containing the main text of the document. If specified, the method will attempt to split metadata out of the file and add whatever remains to the manifest of the OPF. o "mediatype" (optional) The media type (mime type) of the document specified via "textfile". If "textfile" is not specified, this argument is ignored. If "textfile" is specified, but "unpack()" This is a dispatcher for the specific unpacking methods needed to unpack a particular format. Unless you feel a need to override the unpacking method specified or detected during object construction, it is probalby better to call this than the specific unpacking methods. "unpack_ereader()" Unpacks Fictionwise/PeanutPress eReader (-er.pdb) files. "unpack_imp()" Unpacks SoftBook/GEB/REB/eBookWise (.imp) files. "unpack_mobi()" Unpacks Mobipocket (.prc / .mobi) files. "unpack_msreader()" Unpacks Microsoft Reader (.lit) files "unpack_palmdoc()" Unpacks PalmDoc / AportisDoc (.pdb) files "unpack_zip()" Unpacks Zip archives (including ePub files). BUGS AND LIMITATIONS
o DRM isn't handled. Infrastructure to support this via an external plug-in module may eventually be built, but it will never become part of the main module for legal reasons. o Unit tests are incomplete o Documentation is incomplete. Accessors in particular could use some cleaning up. o Need to implement setter methods for object attributes o Import/extraction/unpacking is currently limited to PalmDoc, Mobipocket, and eReader. Extraction from Microsoft Reader (.lit) and ePub is also eventually planned. Other formats may follow from there. AUTHOR
Zed Pobre <zed@debian.org> LICENSE AND COPYRIGHT
Copyright 2008 Zed Pobre Licensed to the public under the terms of the GNU GPL, version 2 perl v5.10.1 2012-01-05 EBook::Tools::Unpack(3pm)
Man Page