PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, August 24, 2022

[FIXED] How do you test your Perl module to check if Makefile.PL declares all dependencies?

 August 24, 2022     cpan, module, perl, release, testing     No comments   

Issue

I would like to write a t/00-check-deps.t module to find all dependencies in MyModule.pm and make sure they exist in Makefile.PL before release.

This way when I do make test before distributing to CPAN I will know that nothing was forgotten prior to publishing. I've looked at the ExtUtils suite, but I've not seen anything obvious that already solves this. It seems like a common issue people would want to solve.

How would you do this?


Solution

Here is how I would do it. Thanks @ikegami for the scandeps hint:

find lib -name '*.pm' | xargs scandeps.pl -R | \
  perl -MJSON -le '
    undef $/; 
    %d=eval(<STDIN>);
    $j=JSON::from_json(`cat MYMETA.json`); 
    foreach (keys(%d)) {
      warn "Missing: $_ => $d{$_}\n" if !defined($j->{prereqs}{runtime}{requires}{$_}) 
    }
    '

prints:

Missing: Carp => 1.42
Missing: PDL::Constants => 0.02
Missing: Exporter => 5.72
Missing: constant => 1.33
Missing: PDL => 2.080
Missing: PDL::LinearAlgebra => 0.35
Missing: PDL::Ops => undef


Answered By - KJ7LNW
Answer Checked By - Willingham (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing