The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::MakeEPUB - Create an EPUB ebook

VERSION

This document describes App::MakeEPUB version v0.3.2

SYNOPSIS

    use App::MakeEPUB;

    my $epub = App::MakeEPUB->new( { epubdir => $epubdir } );

    $epub->add_metadata( { identifier => $identifier,
                           language   => $language,
                           title      => $title,
                           creator    => $creator,
                           publisher  => $publisher,
                           rights     => $rights,
                           cover      => $cover, } );

    $epub->write_epub();

DESCRIPTION

This library is used by the script make-epub to create an ebook in EPUB format.

INTERFACE

new()

    my $epub = App::MakeEPUB->new( {
        epubdir     => $epubdir,
        level2      => $level2,
        spine_order => $spine_order,
    } );

Create an App::MakeEPUB object;

The named argument epubdir is the path to the directory containing the files for the ebook.

The named argument spine_order takes a string containing the names of the XHTML files in spine order as a comma separated list. If it is missing the names are sorted by alphabet.

The named argument level2 takes a string containing instructions for HTML::Element->look_down() on how to find the text and id for the level 2 navPoints in the file toc.ncf. It takes a string like 'attr1:val1,attr2:val2,...' and translates it into

  HTML::Element->look_down( { attr1 =>  val1, attr2 => val2, ... } );

The content for the navPoint is taken from the first <a> tag inside each HTML::Element found by look_down() and containing an attribute id. The text for the navPoint is taken from the whole text inside each HTML::Element found.

If the argument level2 is missing, '_tag:span,class:h2' is taken. This will take the navPoints from all spans looking roughly like

  <span class="h2"><a id="navid">some text</a></span>

and translates them to something like

  <navPoint id="navpoint-id" playOrder="order">
    <navLabel><text>some text</text></navLabel>
    <content src="filename#navid" />
  </navPoint>

add_metadata()

    $epub->add_metadata( { identifier => $identifier,
                           language   => $language,
                           title      => $title,
                           creator    => $creator,
                           publisher  => $publisher,
                           rights     => $rights,
                           cover      => $cover, } );

Add Metadata to the EPUB.

The following keys are accepted:

identifier, language, title, creator, publisher, rights

These go into the <metadata> section of the content.opf as <dc:identifier...>, <dc:language...> and so on.

cover

This goes into die <metadata> section of the content.opf as <reference type="cover" ...>.

write_epub()

    $epub->write_epub();
    $epub->write_epub($filename);

This method writes the epub.

If a filename is given it writes the file under that name. Otherwise the name will be built from the name of the directory containing the files given in argument epubdir to new() with the suffix .epub added.

DIAGNOSTICS

Error message here, perhaps with %s placeholders

[Description of error here]

Another error message here

[Description of error here]

[Et cetera, et cetera]

CONFIGURATION AND ENVIRONMENT

App::MakeEPUB requires no configuration files or environment variables.

DEPENDENCIES

None.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-app-makeepub@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Mathias Weidner <mamawe@cpan.org>

LICENCE AND COPYRIGHT

Copyright (c) 2013, Mathias Weidner <mamawe@cpan.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.