On Fri, Oct 08, 2004 at 04:50:28PM +0530, Padubidri Nagaraja Rao, Guruprasad 
(Guruprasad)** CTR ** wrote:

> Hi,
> 
> I've few perl scripts called from C++ programs. I wanted to do code coverage
> for
> those scripts and i am using Devel::Cover module. Since the existing C++ 
> programs are huge and takes lot of time to compile, I don't want to change 
> the existing C++ code to build those scripts with coverage. For example, i 
> don't want the following changes to be done inside a C++ program.
> 
> perl -MDevel::Cover <script name with arguments>
> 
> Is it possible to change the perl script itself in such a way that it can
> give
> code coverage metrics along with normal execution. I tried to include 
> Devel::Cover module inside the perl script (use Devel::Cover) and executed. 
> It didn't give any metrics and just printed 'n/a' against all the 
> coverages (statement, branch, sub, cond, time, total). 
> 
> How to handle this scenario?
> 
> One more thing to add. if it is possible to do it inside the perl script
> then 
> Is it possible to read some ENV variable and decide on whether to include 
> coverage or not. I am just trying to add some flexibility so that 
> i don't get the coverage everytime it is executed and i only want it when i
> am 
> running the unit test cases of C++ programs. 

It is unclear to me whether you are embedding a perl interpreter in your
program, or just calling perl from within the program.  In either case,
you should be able to control the collection of coverage data by setting
PERL5OPT.

  $ PERL5OPT=-MDevel::Cover your_prog

This will not work, however, if you have embedded perl and pass in a
modified environment which changes that variable.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

Reply via email to