pjcj / Devel--Cover

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

db option not recognized in 1.38 #316

Open hedges333 opened 1 year ago

hedges333 commented 1 year ago

Trying to do cover -db /tmp/cover_db with v1.38.

Unknown option: db
Invalid command line options at /[omitted]/lib/perl5/x86_64-linux/Devel/Cover/Report/Html_minimal.pm line 714.

I tried adding it as HARNESS_PERL_SWITCHES=-MDevel::Cover=-db,/tmp/cover_db and that didn't help either.

Thanks.

hedges333 commented 1 year ago

In bin/cover I found it's undocumented that I can run it as cover /tmp/cover and it will shift the DB path from @ARGV.

hedges333 commented 1 year ago

Not sure how to open a PR since I can't push my branch but here is "the solution":

diff --git a/lib/Devel/Cover.pm b/lib/Devel/Cover.pm
index ec9422dd..21063330 100644
--- a/lib/Devel/Cover.pm
+++ b/lib/Devel/Cover.pm
@@ -1331,6 +1331,12 @@ To alter default values:

  perl -MDevel::Cover=-db,cover_db,-coverage,statement,time yourprog args

+To report from or delete a DB file in an alternate location:
+
+ perl -MDevel::Cover=-db,/tmp/cover_db
+ cover /tmp/cover_db
+ cover /tmp/cover_db -delete
+
 =head1 DESCRIPTION

 This module provides code coverage metrics for Perl.  Code coverage metrics
jsoref commented 1 day ago

@hedges333: fwiw, to create a PR, you'd first use https://github.com/pjcj/Devel--Cover/fork to create a fork, and then push your branch to your fork, and finally create the PR to this repository.