Grokbase Groups Perl qa July 2005
In HTML::Widgets::NavMenu I have the following code:

sub get_coords_while_skipping_skips
my $self = shift;

my $callback = shift;
my $coords = shift || $self->get_current_coords(); # line 571

Now when I run the tests with Devel::Cover it reports the following for line
571 in the Condition Coverage:

A B dec
0 0 0 # marked as red.

0 1 1

1 X 1

Now in order to eliminate the red I need to make sure both operands are False.
However, $self->get_current_coords() cannot be false, and that's not what I'm
using || for. It's not an if ( FOO || BAR ). It's instead something like

my $coords = shift;

if (!$coords)
$coords = $self->get_current_coords();

Which would probably eliminate the problem, but is much less elegant.

I should also note that I have many

my @coords = @{shift || $self->get_current_coords};

statements which exhibit this problem.

So what should I do to eliminate it?

Thanks in advance,

Shlomi Fish

Shlomi Fish

Tcl is LISP on drugs. Using strings instead of S-expressions for closures
is Evil with one of those gigantic E's you can find at the beginning of

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 26 | next ›
Discussion Overview
groupqa @
postedJul 11, '05 at 4:30p
activeJul 14, '05 at 8:23p



site design / logo © 2021 Grokbase