Boris Däppen
Boris Däppen

Reputation: 1196

Dependency of Image::Imlib2 on CpanTesters

I get a lot of errors on CpanTesters for my module EBook::MOBI::Image (It is just some additional stuff for EBook::MOBI. Like this I keep graphics-dependencies from the main module away for those who don't need it anyways). All tests, except those for GNU/Linux fail:

http://www.cpantesters.org/distro/E/EBook-MOBI-Image.html#EBook-MOBI-Image-0.11

Since I only have GNU/Linux and have some lack of experience in general, I ask for some help here. The test results seem to indicate, that there is a problem with the dependency of Image::Imlib2

http://www.cpantesters.org/cpan/report/2306795e-99db-11e2-8c80-50d7c5c10595

There it says I should take care, that Image::Imlib2 is in the "Makefile.PL", but it is there as you can see:

https://metacpan.org/source/BORISD/EBook-MOBI-Image-0.11/Makefile.PL#L24

Image::Imlib2 itself does not have this issues. Tests pass all the systems:

http://www.cpantesters.org/distro/I/Image-Imlib2.html#Image-Imlib2-2.03

Can somebody give a hint here what is wrong? The code is hosted here:

https://github.com/borisdaeppen/EBook-MOBI-Image

Thanks a lot.

Upvotes: 1

Views: 280

Answers (1)

mob
mob

Reputation: 118625

When I try to install this module (on Cygwin) with the cpan command:

  1. cpan recognizes that I need the Image::Imlib2 module (warning: prerequisite Image::Imlib2 0 not found)

  2. cpan downloads and attempt to build Image::Imlib2

  3. build of Image::Imlib2 fails (you must install the imlib2 library before you can install Image::Imlib2 ... Make has some problems, won't install)

  4. cpan continues to build EBook::MOBI::Image (... Continuing, but chances to succeed are limited)

  5. and of course, the tests for Ebook::MOBI::Image fail

The PREREQ_PM => ... directive in Makefile.PL tell cpan to make an effort to satisfy a prerequisite, but as you see, it will continue the build even if the prerequisite fails to install. The PREREQ_PM directive is good enough for most modules on CPAN, but not for modules that need an external library that cpan can't install on its own.

I think what you want in this case is for the cpan tester to bail out if you can't load the Image::Imlib2 module, and the place to do that is early in Makefile.PL.

if (!eval "require Image::Imlib2") {
    print "This distribution requires Image::Imlib2!\n";
    exit 0;
}

For systems that can't or won't install Image::Imlib2, bailing out of Makefile.PL will cause the tester to report a result of N/A instead of FAIL.

Upvotes: 3

Related Questions