pjcj / Devel--Cover

Code coverage metrics for Perl
http://www.pjcj.net/perl.html
93 stars 87 forks source link

Need for B::Debug not evident, not exercised in test suite #289

Closed jkeenan closed 1 year ago

jkeenan commented 2 years ago

CPAN module B::Debug is listed as a prerequisite for Devel::Cover in Makefile.PL, lib/Devel/Cover.pm, and some of the files under util/. However, it is not apparent to me how this module is used in the Devel-Cover distribution.

In my is-b-debug-needed-20211124 branch I have made exactly one change from master:

diff --git a/lib/Devel/Cover.pm b/lib/Devel/Cover.pm
index bcdc6d58..5140128e 100644
--- a/lib/Devel/Cover.pm
+++ b/lib/Devel/Cover.pm
@@ -25,7 +25,7 @@ use Devel::Cover::Inc;
 BEGIN { $VERSION //= $Devel::Cover::Inc::VERSION }

 use B qw( ppname main_cv main_start main_root walksymtable OPf_KIDS );
-use B::Debug;
+#use B::Debug;
 use B::Deparse;

 use Carp;

If I build normally and run the test suite, all tests PASS. That suggests that in whatever way B::Debug is being used by Devel-Cover, that way is not being exercised in the test suite. This in turn suggests that B::Debug may not actually be needed.

Why is this important?

Until approximately 2019 B::Debug shipped with the Perl 5 core distribution, so it didn't need to be explicitly stated as a prerequisite. However, B::Debug was dropped from core and so had to be added explicitly.

Earlier this year I attempted to install Devel-Cover on FreeBSD-13 using the FreeBSD package devel/p5-Devel-Cover. That attempt failed because the installation of Perl 5 on that platform no longer includes B::Debug. I created a port for B::Debug, which was accepted into the ports tree, as was a subsequent update for devel/p5-Devel-Cover. On FreeBSD, the kernel and ports are released simultaneously, so as of the next release you should be able to install Devel::Cover by the ports mechanism.

That being said, if Devel-Cover doesn't really need B::Debug anymore, we should drop it as a prerequisite and simplify maintenance going forward both on CPAN and in package managers. If, however, it is needed, then we should document that need either explicitly in the documentation or via an entry in the test suite.

Thank you very much. Jim Keenan

pjcj commented 1 year ago

Thanks for finding this and investigating. I have removed the dependency on B::Debug with f257681b89e06f7494a7155f8e1abfe09b443bc4. I suspect it was something I used long ago and forgot to remove the dependency. So sorry for the extra work that caused.