On Fri, Jul 09, 2004 at 12:10:52PM -0500, Pete Krawczyk wrote: > Consider the following code: > > $impclass ||= implementor($scheme) || > do { > require URI::_foreign; > $impclass = 'URI::_foreign'; > }; > > That's in URI.pm, lines 54-58. > > Devel::Cover treats that as a conditional. So short of deleting > URI::_foreign, that do BLOCK is never going to return false.
There's a whole set of these sort of problems. sub new { my $proto = shift; my $class = ref $proto || $proto; Devel::Cover wants you to consider the case where both ref $proto and $proto are false. This is an (almost) impossible condition and certainly not an interesting one to bother testing. Then there are conditions that can't both occur in a single environment. if( $^O eq 'MSWin32' ) { do this; } else { do that; } Unless you start combining the coverage runs from all hopolites. Which might not be a bad thing. It certainly would help things like Class::DBI which looks like it has piss poor coverage because it has so many optional modules for testing. Don't be mesmerized by 100% coverage. Devel::Cover isn't perfect and even if it was there are uncoverable things. Even if you were to achieve 100% coverage that doesn't guarantee anything. Coverage doesn't say anything about the data being tested against, things going funny because the environment changed, or an external utility (database). Test coverage is a useful *heuristic* for test effectiveness. Like all heuristics if you push it too far it falls apart. Get as close to 100% as is useful and don't worry about the rest. -- Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern/ 11. Every old idea will be proposed again with a different name and a different presentation, regardless of whether it works. -- RFC 1925