dotReader
view release on metacpan or search on metacpan
lib/dtRdr/Library.pm view on Meta::CPAN
my @books = $self->find_book_by($key, $args{$key});
@books or die "no books matching $key eq $args{$key}";
(@books == 1) or die "too many books @books";
my $B = $books[0];
# this will get us by until config is operable
# (and shouldn't break after it works either)
require dtRdr::Plugins::Book;
dtRdr::Plugins::Book->init();
# requires that config sets type -> class prefs
my $book_class = dtRdr::Plugins::Book->class_for_type($B->type);
$book_class or die "cannot get a plugin for $B->{type}";
0 and warn "book class: $book_class";
my $book_object = $book_class->new();
# TODO add abstraction somewhere in here
# (e.g. it might be http://, absolute, etc)
my $uri = $self->directory . '/' . $B->uri;
# NOTE: Do not be tempted to (-e $uri) here, let the book die.
0 and warn "book is $uri";
( run in 1.201 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )