Reputation: 95
I have a .pm module (Main.pm
) which has a wrapper around it written in perl(Mainwrapper). These two are part of development team. I have written a test script in perl to test the wrapper(Testwrapper.pl
). Now, I need to get the coverage using Devel::Cover
for the wrapper(written by someone else) and its test script(written by me). The Mainwrapper of course uses the .pm module.
I tried using perl -MDEVEL:COVER Testwrapper.pl
after having all Mainwrapper Main.pm
and Testwrapper.pl
in the same directory. Also included Main.pm
in the Testwrapper.pl
code. I could only get coverage for Testwrapper.pl
and the Main.pm
module in the report. One workaround I performed was to rename the Mainwrapper as Mainwrapper.pm
and included in the Testwrapper.pl
file. This would give me coverage for all. However, this is not a long term solution. Can anyone please tell me how to go with this?
Upvotes: 0
Views: 208
Reputation: 780
I'm a bit confused about the different modules and scripts. But I gather that you have a module Main.pm, two wrapper modules using Main.pm, and two scripts using the two wrapper modules.
By running perl -MDevel::Cover script1.pl
and perl -MDevel::Cover script2.pl
you create two directories in cover_db/runs. Then you can run the command cover. This will generate the file cover_db/coverage.html. Open the HTML file in a browser and you should see a merged report containing script1.pl and script2.pl.
Upvotes: 1