NAME
EBook::Gutenberg::Catalog - Project Gutenberg catalog interface
SYNOPSIS
use EBook::Gutenberg::Catalog;
my $catalog = EBook::Gutenberg::Catalog->new($path);
DESCRIPTION
EBook::Gutenberg::Catalog is a module that provides an interface for reading Project Gutenberg CSV catalog files. This is developer documentation, for gutenberg user documentation you should consult its manual.
METHODS
- $cat = EBook::Gutenberg::Catalog->new($path)
-
Returns a blessed EBook::Gutenberg::Catalog object representing a Project Gutenberg catalog file stored in
$path
.$path
doesn't actually have to exist, it can be fetched later via thefetch()
method. - $path = $cat->path()
-
Returns path to
$cat
's catalog file. - $path = $cat->set_path($new)
-
Set
$cat
's catalog file to$new
. Returns newly set path. - $fetch = $cat->fetch()
-
Fetches Project Gutenberg catalog file and writes it to the path specified in
new()
. Returns the path to the fetched file. - $book = $cat->book($id)
-
Get hash ref representing the book with an ID
$id
from the catalog file. The hash ref has the following format:{ 'Text#' => '...', 'Type' => '...', 'Issued' => '...', 'Title' => '...', 'Language' => '...', 'Authors' => '...', 'Subjects' => '...', 'LoCC' => '...', 'Bookshelves' => '...', }
- $books = $cat->books([\%params])
-
Returns array ref of hash refs representing books from catalog that conform to the parameters supplied by
\%params
. The hash refs follow the same format used by the ones returned bybook()
.\%params
is a hash ref of ebook fields and subroutine references that are used togrep
for specific ebooks. The subroutine will have$_
set to the value of the field. If the subroutine does not return true when given a value, the ebook will be filtered out. The following are valid fields to use for\%params
.
AUTHOR
Written by Samuel Young, <samyoung12788@gmail.com>.
This project's source can be found on its Codeberg page. 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.