#668638 dh-make-perl: Incorrect dependency detection (because Module::Depends is used)

#668638#5
Date:
2012-04-13 19:02:05 UTC
From:
To:
When trying to build Tk::Wizard with dh-make-perl using

    dh-make-perl --cpan=Tk::Wizard --build

an obviously wrong dependecy was detected:

- Win32::TieRegistry  not found in any package
   CPAN contains it in Win32-TieRegistry
   substituting package name of libwin32-tieregistry-perl

Problem is very probably that META.yml is used for
dependency detection. This is wrong unless dynamic_config:0 is
set in the META file. If dynamic_config is not defined or
set to 1, then Makefile.PL or Build.PL must be run and
the created Makefile or Build must be inspected for the
correct dependencies (in newer Perls one can use the created
MYMETA* files instead).

META.yml is only meant for statistical analysis, but not for
real dependency resolution.

In the case of Tk::Wizard the Windows-specific module is
optional and only used on Windows systems. Probably the module
author was creating the distribution on a Windows system,
so the generated META.yml had this windows-specific module
in the prerequisites list. Just conincidence.

I can point you to the correct dependency detection code in
CPAN.pm. Maybe using Module::Depends::Intrusive *always*
would also do the right thing.

Regards,
    Slaven

#668638#8
Date:
2013-08-08 16:26:51 UTC
From:
To:
-=| Slaven Rezic, 13.04.2012 21:02:05 +0200 |=-

Thanks for the explanation and sorry for replaying more than an year
later.

That would be very helpful indeed. Hopefully there is a way to just
use some CPAN.pm-provided method to obtain this information.

Tried that, but for this package M:D:Intrusive returns an empty hash
:/

#668638#13
Date:
2013-08-08 20:26:17 UTC
From:
To:
Damyan Ivanov <dmn@debian.org> writes:
fix the problem. Modern ExtUtils::MakeMaker and Module::Build write a
"MYMETA.yml" (and MYMETA.json) file when executing "perl Makefile.PL"
resp. "perl Build.PL", and this file contains all fields as META.yml,
but dynamically evaluated.

In the case of Tk::Wizard the requires field in MYMETA.yml looks like
this:

requires:
  Carp: 0
  Cwd: 0
  ExtUtils::testlib: 0
  File::Copy: 0
  File::Path: 0
  File::Spec: 0
  FileHandle: 0
  IO::Handle: 0
  LWP::UserAgent: 0
  Scalar::Util: 0
  Test::More: 0
  Tk: 0
  Tk::After: 0
  Tk::DialogBox: 0
  Tk::DirTree: 0
  Tk::ErrorDialog: 0
  Tk::Frame: 0
  Tk::LabFrame: 0
  Tk::MainWindow: 0
  Tk::ProgressBar: 0
  Tk::ROText: 0

That is, the Win32* modules are gone.

So probably the fix is: run Makefile.PL/Build.PL, and if there was a
MYMETA.yml file written, use this, else fallback to META.yml (the
fallback probably should never happen, so is worth a warning).

Regards,
    Slaven