Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Devel-Cover CPAN distribution.

Report information
The Basics
Id: 13540
Status: resolved
Priority: 0/
Queue: Devel-Cover

People
Owner: Nobody in particular
Requestors: Paul.Marquess [...] btinternet.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.53
Fixed in: (no value)



Subject: Condition
Hi Paul, noticed a minor issue with Devel::Cover. Consider this code sub FRED { 1 } sub joe { my $x = shift || FRED ; } joe(); joe(1); When I send it through Devel::Cover it reports 67% condition coverage for the line my $x = shift || FRED ; It's reporting that the A B Dec ------- 0 0 0 0 1 1 1 X 1 Not sure if this edge case can be detected easily. cheers Paul
[PMQS - Tue Jul 5 12:42:26 2005]: Show quoted text
> Hi Paul, > > noticed a minor issue with Devel::Cover. > > Consider this code > > sub FRED { 1 } > > sub joe > { > my $x = shift || FRED ; > } > > joe(); > joe(1); > > When I send it through Devel::Cover it reports 67% condition coverage > for the line > > my $x = shift || FRED ; > > It's reporting that the > > A B Dec > ------- > 0 0 0 > 0 1 1 > 1 X 1 > > Not sure if this edge case can be detected easily. > > cheers > Paul
Damn! -- accidentally pressed Submit before I had finished the message. Think there is enough there for you to get the jist of the issue though. Give me a shout if you need any more data. Excellent module by the way. Paul
This obviously isn't my day. I was attempting to show you a cut-down example that showed the behaviour I was getting with a much larger script. The big difference between the, obviously incorrect, example I posted (forgot to make it a sub that gets folded to a constant) and my real script, is the real script uses an autoloaded constant from XS-land. The bahaviour is identical to my erroneous example though -- Devel::Cover doesn't notice that the FRED is a constant. Give me a shout if you need any more info, and I understand that this may just be something you can't spot. Paul
I remembering seeing this mentioned here a few months ago: http://perlmonks.org/?node_id=579928 If you're willing to refactor that line to make the coverage stats go to 100%, you could do: my $x = shift; $x = FRED unless $x; but obviously that doubles the lines :)
Thanks for the report. Having thought about this a little, I've decided not to do anything about it. At least, not for now. In general, Devel::Cover can't know whether a subroutine is constant or not. If you as a programmer know, then you should say so by giving a prototype of () and Devel::Cover should then do the right thing. If it doesn't, or you think there's more that Devel:Cover could or should do, then please reopen the ticket. Otherwise, the ticket is closed. Thanks again,