Subject: | pretty print outer for loop |
I don't believe the outer for loop will work correctly. It's not clear
to me why it was setup the way it was, but when I've set the first_hop
parameter to something other than 1 I had to apply a patch such that
shown below. It is probably better named first_ttl like it is
traceroute(1). In the current PurePerl.pm release if the first_hop is
set to 1 and the last is 30, $lasthop = 30, it works fine. However,
setting first_hop to something different makes the loop iterate an
incorrect number of times. Please accept this patch unless I'm missing
something obvious?
--- PurePerl.pm
+++ jtk-PurePerl.pm
@@ -188,9 +188,7 @@
print " (" . inet_ntoa($self->{'_destination'}) . "), ";
print $self->max_ttl . " hops max, " . $self->packetlen ." byte
packets\n";
- my $lasthop = $self->first_hop + $self->hops - 1;
-
- for (my $hop=$self->first_hop; $hop <= $lasthop; $hop++)
+ for (my $hop=$self->first_hop; $hop <= $self->hops; $hop++)
{
my $lasthost = '';