in reply to Re: Devel::Cover for myfile.pl with different command-line input arguments
in thread Devel::Cover for myfile.pl with different command-line input arguments

Mr. Muskrat, thanks. This definitely helped.

But I am not very sure on the coverage by Devel::Cover itself. I have legacy code. For e.g., we use a certain Perl custom-developed package which is basically a wrapper around Perl GetOpt. When I pass an option arg1 = "abc" 1st time, and then arg1="xyz" the 2nd time, and I have code like: if ($run eq "abc") {do_this} else {do_that}.

I expected devel_cover to show me the if-loop covered 1st time. Else-loop uncovered. While vice versa in the 2nd run.

It did not. I hope I am not missing anything.

  • Comment on Re^2: Devel::Cover for myfile.pl with different command-line input arguments

Replies are listed 'Best First'.
Re^3: Devel::Cover for myfile.pl with different command-line input arguments
by Mr. Muskrat (Canon) on Aug 24, 2016 at 14:03 UTC

    If you test coverage with the first condition and then generate a report it should show the if was covered. If you test coverage with the second condition and then generate a report it should show that the else was covered. If you test coverage of both conditions and then generate the report (as I described in my previous reply) then it should show both the if and the else have been covered.

      Thanks. This helped.