Question: In some code coverage tools you can "hide" certain lines of code from the coverage tool, so that those lines do not count towards the coverage totals. For example, some code might be run only in circumstances that are hard or impossible to test (such as certain hardware failures). Thus, you might get 100% coverage reported even though some code was not exercised. 

Setting aside for the moment whether this is wise, is this sort of thing possible with Perl's `Devel::Cover`? 

(`Devel::Cover` can ignore entire *files*, but I am interested in ignoring just a few lines in a single file.)

Answer: 
According to the [TODO file](http://cpansearch.perl.org/src/PJCJ/Devel-Cover-0.99/docs/TODO) on CPAN, this capability is not currently supported, but the developers see it as a valuable addition:

> 
> * Enhancements:
> 	+ Marking of unreachable code - commandline tool and gui.
> 
> 
> 

The `cover` script mentions promising options: `-add_uncoverable_point` and `-delete_uncoverable_point`.
A lot of uncoverable code features have been implemented but they are not documented because I wasn't sure of the interface. However, it's been a few years since anything changed in that area.

Probably the easiest way to see how to use the features is to look at tests/uncoverable in the distribution (see <https://github.com/pjcj/Devel--Cover/blob/master/test/uncoverable>). If you can't or don't want to change your code you can use the .uncoverable file (see <https://github.com/pjcj/Devel--Cover/blob/master/tests/.uncoverable>) and the cover options as mentioned by toolic.

If you do this, be sure to use the basic\_html report which will mark a construct as in error if you tag it as uncoverable but it gets executed anyway.

I really should get around to tidying everything up and documenting it.