It's not just qr.
Seems like Devel::Cover can cope only with constants as RHS of an or-condition, or the other way round, an op as the RHS screws things. Running your modified code
$self->{ name } = $args{ name } || do { 'default'}; $self->{ value } = $args{ value } || do { '' }; $self->{ chars } = $args{ chars } || do { qr{^[a-z]+$} };
which passes fine, I get
---------------------------- ------ ------ ------ ------ ------ ------ + ------ File stmt bran cond sub pod time + total ---------------------------- ------ ------ ------ ------ ------ ------ + ------ cover.pl 100.0 n/a 66.7 100.0 n/a 100.0 + 95.3 Total 100.0 n/a 66.7 100.0 n/a 100.0 + 95.3 ---------------------------- ------ ------ ------ ------ ------ ------ + ------
<update> From that output it seems that for e.g. $a || op($b) Devel::Cover erroneously adds an extra code path coverage branch for op to the conditional's to-be-covered count. You test both cases for the conditional, that makes 2 out of 3 "cases" = 66.7% coverage. </update>
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re: Devel::Cover oddity with condition coverage reporting?
by shmem
in thread Devel::Cover oddity with condition coverage reporting?
by chargrill
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |