How to run perl test in debug mode?

I am trying to run a test under a debugger like:

perl -d $(which prove) t/file.t 

But this does not affect, because each test runs as a separate task.

I found the --exec , but when I provided it, I lost any option from the .proverc file and the command line

 prove -Ithis/is/lost --exec 'perl -d' t/file.t 

How to run tests with prove with additional parameters and not lose those parameters that were provided in the .proverc file and command line?

I do not want to repeat myself and write:

 prove --exec 'perl -d -Ilib -Ilocal/lib/perl5' t/file.t 

So far, -Ilib and -Ilocal/lib/perl5 are in the .proverc file

+5
source share
1 answer

You can repeat it once if you set the PERL5OPT environment PERL5OPT .

 export DBG_MODE='-d -Ilib -Ilocal/lib/perl5' prove t/file1.t # regular use PERL5OPT=$DBG_MODE prove t/file2.t # with debugger 

or with an alias or bash function

 alias proved='PERL5OPT="-d -Ilib -Ilocal/lib/perl5" prove' 
+1
source

Source: https://habr.com/ru/post/1265498/


All Articles