From 216faa551997c3eaf1a7ccb9d512efb8d50df118 Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Fri, 20 Jul 2007 15:41:53 +0100 Subject: [PATCH] prevent hop counts of -1 being generated. --- perl/DXProt.pm | 9 ++++++--- perl/Version.pm | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/perl/DXProt.pm b/perl/DXProt.pm index bc753c3d..596f1f08 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -1008,7 +1008,7 @@ sub adjust_hops my $call = $self->{call}; my $hops; - if (($hops) = $s =~ /\^H(\d+)\^?~?$/o) { + if (($hops) = $s =~ /\^H([-\d]+)\^?~?$/o) { my ($pcno) = $s =~ /^PC(\d\d)/o; confess "$call called adjust_hops with '$s'" unless $pcno; my $ref = $nodehops{$call} if %nodehops; @@ -1017,8 +1017,11 @@ sub adjust_hops return "" if defined $newhops && $newhops == 0; $newhops = $ref->{default} unless $newhops; return "" if defined $newhops && $newhops == 0; - $newhops = $hops if !$newhops; - $s =~ s/\^H(\d+)(\^~?)$/\^H$newhops$2/ if $newhops; + $newhops = $hops unless $newhops; + return "" unless $newhops > 0; + $s =~ s/\^H(\d+)(\^~?)$/\^H$newhops$2/ if $newhops != $hops; + } else { + return "" unless $hops > 0; } } return $s; diff --git a/perl/Version.pm b/perl/Version.pm index 5b13b540..db524ea5 100644 --- a/perl/Version.pm +++ b/perl/Version.pm @@ -11,6 +11,6 @@ use vars qw($version $subversion $build); $version = '1.54'; $subversion = '0'; -$build = '122'; +$build = '123'; 1; -- 2.43.0