2008-03-14: MobiPerl MOVED!!!

The new home for MobiPerl is https://dev.mobileread.com/trac/mobiperl/wiki. This page and download section will not be updated anymore.

MobiPerl

MobiPerl is a collection of tools I (Tommy Persson, tpe@ida.liu.se) am writing in Perl for handling MobiPocket files. The programs are (follow the link for documentation):

To download the latest version go here. The programs are released under GPL3.

To run the programs you have to install Perl and some additional modules or you can use the Windows binaries that are available (the rar file). If you want to be able to change the programs yourself or if you want to always have the latest version you should not use the binary version.

Since no official documentation for the MobiPocket is available there might be some mistakes in the generation of the MobiPocket files. It seems to work but there might be remaining bugs. So always keep you original files so you can repeat the conversion if necessary.

Installing ActiveState Perl on Windows

I used ActivePerl 5.8.8 build 820 and for building the Windows binary I used PAR-Packer-588.ppd and I hade to use the -M flags to pp to include modules. If you just want to run the programs any ActivePerl version should work (the latest 5.8.8 for example).

After you have installed ActivePerl start the "Perl Package Manager" (from the program menu) and install packages. A package can also be installed from a cmd prompt with "ppm install packagename".

You have to add the repository http://theoryx5.uwinnipeg.ca/ppms/package.lst to the package manager (in preferences). Then Install the following packages:

You might have to install a BMP package also. Just search for BMP and install the package you find.

To build the binaries you need nmake. Download nmake 1.5 from Microsoft. Run nmake15.exe and copy nmake.exe and nmake.err to a directory in your path, like e.g. the bin directory of the Perl installation.

Installing Perl and required Modules on a Mac

This information is taken from a posting by Beau Bruce on MobileRead.

Mac OS X comes with perl already installed (v5.8.6 under /usr/bin) - I don't know if you need v5.8.8 installed the scripts to work because I already had v5.8.8 installed.

If someone needs to install perl 5.8.8 on their machine for it to work the following would need to be done:

  1. Install macports http://www.macports.org/
  2. Use macports to obtain perl in Terminal.app
  3. $ sudo port -v selfupdate
    $ sudo port -v install perl5.8

  4. This should have placed perl in /opt/local/bin (and I believe changed the paths properly to find it) you can test by:
  5. $ which perl # tells you what directory it is in
    $ perl -version # tells you what version is active

  6. Install all requried modules using CPAN according to Installing all required modules from CPAN.
  7. Now download the latest tarball from the mobiperl website, decompress it, and move the libraries into the distribution (on my machine using macports - /opt/local/lib/perl5/site_perl/5.8.8/)
  8. # there maybe a friendlier way to do this but this works
    # do this in the directory where you downloaded the mobiperl tar
    $ tar xv mobiperl-0.0.27.tar
    $ cd mobiperl-0.0.27
    $ sudo cp Palm MobiPerl /opt/local/lib/perl5/site_perl/5.8.8

  9. (optional) put the mobi2mobi, etc. in good places
  10. sudo cp lit2mobi mobi2mobi html2mobi mobi2html opf2mobi /usr/bin

Installing all required modules in a Debian installation

For most of the needed modules you can use Debian packages. For the rest install them (as root) from CPAN according to the instructions below.

If you try to run a program and it says something like "Can't locate Image/Size.pm in @INC" then you have to install the file Image/Size.pm. To find what package contains that file you can use for example apt-file:

  invid:~> apt-file search Image/Size.pm
  libimage-size-perl: usr/share/perl5/Image/Size.pm

So the package you should install is "libimage-size-perl".

Installing all required modules from CPAN

If you are not using ActivePerl you can install all required modules from CPAN.

To install all required modules from CPAN you do "perl -MCPAN -e shell" and after you have done the configuring install the modules by giving the install commands according to:

install Palm::PDB
install XML::Parser::Lite::Tree
install GD
install Image::BMP
install Image::Size
install HTML::TreeBuilder
install Getopt::Mixed
install Date::Parse
install Date::Format

After each install command the correct file will be fetched and unpacked and the compiled and tested. If the test succeeds the module will be installed. Modules that are required by the module you are installing will be installed automatically.