Subject: | If blocks with a single statement in the block are not explained correctly |
As shown in the HTML report attached, in code such as:
1 if (sleep(2) || $bool) {
2 sleep 1;
3 }
Line (1) is reported as taking 3 seconds and line 2 is reported as never
being run.
In more complex code, where $bool can be true or false, this means that
it is unclear how many times line (2) was run (ie. how many times the
predicate was true.)
I tested this with Devel::NYTProf 4.05 and 4.06, using perl 5.10.1,
running on Debian Linux with kernel version 2.6.26-2-amd64.
Subject: | example_code-pl-1-line.html |
Message body is not shown because it is too large.
Subject: | example_code.pl |
#!/usr/bin/perl
my $bool = 1;
my @array = 'A' .. 'Z';
if ($bool) {
@array = reverse @array;
}
if ($bool) {
1;
}
if ($bool) {
1;
@array = reverse @array;
}
if ($bool) {
sleep 1;
}
if (sleep(2) || $bool) {
sleep 1;
}