From 7e9852009e053721cb64d9c1c8c4f82457dac181 Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Fri, 21 Jan 2022 18:35:47 +0000 Subject: [PATCH] remove 5.10.1 isms (//= etc) --- perl/DXCommandmode.pm | 5 ++--- perl/DXProtHandle.pm | 10 +++++----- perl/cluster.pl | 4 ++-- perl/console.pl | 4 ++-- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 9e710c11..cd15057d 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -13,7 +13,7 @@ package DXCommandmode; @ISA = qw(DXChannel); -use 5.10.1; +use 5.8.1; use POSIX qw(:math_h); use DXUtil; @@ -801,7 +801,6 @@ sub clear_cmd_cache sub valid_package_name { my $string = shift; $string =~ s|([^A-Za-z0-9_/])|sprintf("_%2x",unpack("C",$1))|eg; - $string =~ s|/|_|g; return "cmd_$string"; } @@ -836,7 +835,7 @@ sub find_cmd_name { }; #wrap the code into a subroutine inside our unique package - my $eval = qq(package DXCommandmode::$package; use 5.10.1; use POSIX qw{:math_h}; use DXLog; use DXDebug; use DXUser; use DXUtil; our \@ISA = qw{DXCommandmode}; ); + my $eval = qq(package DXCommandmode::$package; use 5.8.1; use POSIX qw{:math_h}; use DXLog; use DXDebug; use DXUser; use DXUtil; our \@ISA = qw{DXCommandmode}; ); if ($sub =~ m|\s*sub\s+handle\n|) { diff --git a/perl/DXProtHandle.pm b/perl/DXProtHandle.pm index 36360f71..b77337e4 100644 --- a/perl/DXProtHandle.pm +++ b/perl/DXProtHandle.pm @@ -801,7 +801,7 @@ sub check_add_user # this is to fix a problem I introduced some build ago by using this function for users # whereas it was only being used for nodes. - if ($user->is_user && $user->lockout && ($user->priv // 0) == 1) { + if ($user->is_user && $user->lockout && ($user->priv || 0) == 1) { $user->priv(0); $user->lockout(0); dbg("DXProt: PC92 user record for $call depriv'd and unlocked"); @@ -1571,8 +1571,8 @@ sub _decode_pc92_call my $version = $part[1] || 0; my $build = $part[2] || 0; my $ip = $part[3] || ''; - - if ($version =~ /[,.]/) { + + if (length $version > 4 && $version =~ /[,\.][\da-f]{1,4}/i) { $ip = $version; $version = 0; } @@ -1666,7 +1666,7 @@ sub _add_thingy } elsif ($user->is_spider && ($version < 3000 || ($version > 4000 && $version < 5455))) { unless ($version == 5000 && $build == 0) { $user->sort('A'); - $build //= 0; + $build ||= 0; dbg("PCProt::_add_thingy node $call v: $version b: $build sort ($old) downgraded to " . $user->sort); } } @@ -2022,7 +2022,7 @@ sub handle_92 my $oldbuild = $parent->build || 0; my $oldversion = $parent->version || 0; my $user = check_add_user($parent->call, 'S'); - my $oldsort = $user->sort // ''; + my $oldsort = $user->sort || ''; dbg("PCProt PC92 K v: $version ov: $oldversion b: $build ob: $oldbuild pk: " . ($parent->K || '0') . " uk: " . ($user->K || 0)) if isdbg('pc92k'); diff --git a/perl/cluster.pl b/perl/cluster.pl index 143713ba..466da708 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -141,8 +141,8 @@ use vars qw(@inqueue $systime $starttime $lockfn @outstanding_connects ); -$clusteraddr //= '127.0.0.1'; # cluster tcp host address - used for things like console.pl -$clusterport //= 27754; # cluster tcp port +$clusteraddr ||= '127.0.0.1'; # cluster tcp host address - used for things like console.pl +$clusterport ||= 27754; # cluster tcp port @inqueue = (); # the main input queue, an array of hashes $systime = 0; # the time now (in seconds) $starttime = 0; # the starting time of the cluster diff --git a/perl/console.pl b/perl/console.pl index 13f2bfa1..b71d8a68 100755 --- a/perl/console.pl +++ b/perl/console.pl @@ -50,8 +50,8 @@ use Console; # initialisation # -$clusteraddr //= '127.0.0.1'; -$clusterport //= 27754; +$clusteraddr ||= '127.0.0.1'; +$clusterport ||= 27754; $call = ""; # the callsign being used $node = ""; # the node callsign being used -- 2.43.0