Hi Paul et al.,
In an iterator class I've written, I have this method:
sub do {
my ($self, $code) = @_;
while (local $_ = $self->next) {
return unless $code->($_);
}
}I've written tests for when the code reference returns true and when it returns false. However, Devel::Cover can't tell. It thinks I've missed the C<unless $code->($_)> part.
http://dev.kineticode.com/bricolage2/coverage/blib-lib-Bricolage-Util- Iterator-pm--branch.html
Only if I change the method to this:
sub do {
my ($self, $code) = @_;
while (local $_ = $self->next) {
my $ret = $code->($_);
return unless $ret;
}
}can Devel::Cover tell that the unless expression is covered. Since I don't want to really create an extra variable to store and check a value just to make Devel::Cover see it, is there a way that Devel::Cover could learn to see it, or that I could assure Devel::Cover that, yes, it really is covered?
Thanks!
David
