sgifford has asked for the wisdom of the Perl Monks concerning the following question:

I just uploaded a module to CPAN that depends on some other modules, which I also uploaded. I thought I put the prereq information in Makefile.PL correctly, but after uploading I got an email from cpansmoke@alternation.net complaining that this module wouldn't run because Perl couldn't locate the modules it requires.

The module is RFID::Alien. It requires RFID::Base and RFID::EPC. The Makefile.PL says (excuse the spacing):

use ExtUtils::MakeMaker; WriteMakefile( NAME => 'RFID::Alien', VERSION_FROM => 'lib/RFID/Alien/Reader.pm', PREREQ_PM => { RFID::Tag => 0.002, RFID::EPC::Tag => 0.002, RFID::Reader => 0.002, RFID::Reader::Serial => 0.002, RFID::Reader::TestBase => 0.002, RFID::Reader::TCP => 0.002, POSIX => 0, Time::Local => 0, Carp => 0, Exporter => 0, warnings => 0, constant => 0, }, );
Here's part of the message I get from the smoke tests:
-- This is an error report generated automatically by CPANPLUS, version 0.049. + Below is the error stack during 'make test': + PERL_DL_NONLAZY=1 /usr/bin/perl5.8.0 "-MExtUtils::Command::MM" "-e" "t +est_harne\ss(0, 'blib/lib', 'blib/arch')" t/*.t t/01compile....# Failed test (t/01compile.t at line 8) # Tried to use 'RFID::Alien::Reader'. # Error: Can't locate RFID/Reader.pm in @INC (@INC contains: ...

What else do I need to do? Thanks!

Replies are listed 'Best First'.
Re: Properly expressing module prerequesites for CPAN
by chromatic (Archbishop) on Jul 08, 2004 at 19:57 UTC

    CPANPLUS has a bug that fails to handle missing dependencies properly. I've been ignoring these test cases, as they're fairly useless.

Re: Properly expressing module prerequesites for CPAN
by itub (Priest) on Jul 08, 2004 at 23:44 UTC
    Just to confirm that I also often see these "false positives".
Re: Properly expressing module prerequesites for CPAN
by LTjake (Prior) on Jul 09, 2004 at 18:45 UTC

    Since the report was generated from my machine, i feel obligated to reply. :)

    I've created an RT ticket for this issue. Kane seems to think that version 0.050 might fix the issue and that we should re-evaluate the situation at that time.

    For now you'll just have to ignore these false reports.

    --
    "Go up to the next female stranger you see and tell her that her "body is a wonderland."
    My hypothesis is that she’ll be too busy laughing at you to even bother slapping you.
    " (src)

Re: Properly expressing module prerequesites for CPAN
by hsmyers (Canon) on Jul 09, 2004 at 13:57 UTC
    I was wondering if I could counter this sort of problem by adding a check for dependancies to the normal testing my modules do. Any thoughts?

    --hsm

    "Never try to teach a pig to sing...it wastes your time and it annoys the pig."
      Assuming your module uses the dependencies, you just have a test that does a use_ok on your module (which is probably what the OP's 01_compile.t does.)

      You could go through and do a use_ok for each of your dependencies, but then you need to maintain a list of them in the test as well as Makefile.PL and the module itself.

        The need to imbed the dependancy list in Makefile.PL is why I don't do it now---plus a basic resentment over why I should have to do this in the first place. I'm blindingly clear about the requirements in my docs, that should be enough. Clearly mechanical testing isn't entirely a step forward.

        --hsm

        "Never try to teach a pig to sing...it wastes your time and it annoys the pig."
        It does not matter if your module uses all the dependencies as you (the developer) test because you probably have all of them installed. You probably will not notice missing PREREQ_PM on the developer side.

        I got bit with this frequently until I created Test::Prereq which compiles the modules in a distribution, extracts as much dependency information as it can, and compares that with PREREQ_PM. It saved me a ton of hassles.

        But then, CPANPLUS is still pretty young, and I had to work around it a bit in Test::Prereq so I didn't get back misleading bug reports from CPAN Testers. I would prefer they not use CPANPLUS until it is more mature, but that's life. Fixing distributions to support a popular but buggy distribution tool definitely sucks.

        I did start quoting the module version numbers in PREREQ_PM, though ( "Foo::Bar" => "0.1" ) which seemed to ameliorate the problem for a while, but that was a couple years ago so I forget the details. I haven't bothered to check up on that.

        --
        brian d foy <bdfoy@cpan.org>