Boris Däppen > EBook-MOBI-0.67 > EBook::MOBI::Driver::Example

Download:
EBook-MOBI-0.67.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.67   Source   Latest Release: EBook-MOBI-0.69

NAME ^

EBook::MOBI::Driver::Example - Example plugin implementation.

This module is just for demonstration. I invented a very simple markup, which works only line by line, to show how a plugin can be created.

SYNOPSIS (for users) ^

If you wan't to run this as a plugin, use this code. But I can't imagine any situation where this might be the case for real, since this is just an example for a markup which is not actually existing.

 use EBook::MOBI;
 my $book = EBook::MOBI->new();

 my $foomarkup= <<FOOMARKUP;
 !h! This is a Title
 ! ! A normal text line.
 !i! An italic text line.
 ! ! This is just a very simple example of markup.
 !b! Guess what. This is a bold line.
 
 typo : this is ignored
 !U! unknown command
 FOOMARKUP

 $book->add_content( data   => $foomarkup,
                     driver => 'EBook::MOBI::Driver::Example',
                   );

SYNOPSIS (for developers) ^

Here you can see how the plugin will be called by EBook::MOBI:

 use EBook::MOBI::Driver::Example;

 my $plugin = EBook::MOBI::Driver::Example->new();

 my $format= <<FOOMARKUP;
 !h! This is a Title
 ! ! A normal text line.
 !i! An italic text line.
 ! ! This is just a very simple example of markup.
 !b! Guess what. This is a bold line.
 
 typo : this is ignored
 !U! unknown command
 FOOMARKUP

 my $mobi_format = $plugin->parse($format);

Please check the source code of this module if you are interested in writing a plugin. It will be a good and simple example.

Methods ^

parse

This is the method each plugin should provide! It takes the input format as a string and returns MHTML.

inherited methods

See EBook::MOBI::Driver for usefull inherited methods. You can use the debug methods from this module for example.

COPYRIGHT & LICENSE ^

Copyright 2012, 2013 Boris Däppen, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms of Artistic License 2.0.

AUTHOR ^

Boris Däppen <bdaeppen.perl@gmail.com>

syntax highlighting: