EBook::Ishmael::EBook(3)

NAME
EBook::Ishmael::EBook - Interface for processing ebook documents

SYNOPSIS
  use App::Ishmael::EBook;

  my $ebook = App::Ishmael::EBook->new($file);

DESCRIPTION
EBook::Ishmael::EBook is a module used by ishmael to read ebook files. If you are looking for user documentation, you should consult the ishmael manual (this is developer documentation).

This page will not only detail EBook::Ishmael::EBook's methods, but some of the methods of the various specific ebook modules that this module uses, as they all (mostly) share the same API.

METHODS

  $e = EBook::Ishmael::EBook->new($file, $type, $enc, $net)
Reads $file and returns some ebook object, the exact class will depend the on the format of $file or $type. $type is the name of the format you would like to read $file as. If not specified, "new()" will try to identify $file's format automatically via a series of heuristics. $enc is an optional argument specify the character encoding to read the ebook format as, if the ebook format supports user-specified encodings. $net is an optional boolean argument that determines whether to allow or disallow performing network operations when reading an ebook.

  $html = $e->html([$out])
Dumps the ebook's HTML-ified contents. Contents will be written to $out, if provided, otherwise it will be returned as a string.

  $meta = $e->meta()
Returns a hash ref of the ebook object's metadata.

  $raw = $e->raw([$out])
Dumps the ebook's raw, unformatted text contents.

  $bool = $e->has_cover()
Returns bool of whether the ebook has a cover image or not.

  $cover = $e->cover([$out])
Dumps the ebook's cover image data. Returns "undef" is there is no cover.

  $n = $e->image_num()
Returns the number of images in the ebook.

  $img = $e->image($n)
Returns a scalar ref $img of image data from image $n (starting from 0). Returns "undef" if the image is not available.

SUBROUTINES

  $type = ebook_id($file)
Identifies the ebook format of $file using a series of heuristics. If $file could not be identified, returns "undef".

EXPORTED VARIABLES

  %EBOOK_FORMATS
Hash of ebook formats and their respective class.

AUTHOR
Written by Samuel Young, <samyoung12788@gmail.com>.

This project's source can be found on its Codeberg Page <https://codeberg.org/1-1sam/ishmael>. Comments and pull requests are welcome!

COPYRIGHT
Copyright (C) 2025 Samuel Young

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

SEE ALSO
EBook::Ishmael,