Zed Pobre > EBook-Tools-v0.5.4 > EBook::Tools::Unpack

Download:
EBook-Tools-v0.5.4.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: v0.5.0   Source  

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

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

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 ^

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

syntax highlighting: