From: Andres Salomon <dilinger@debian.org>
Date: Sat, 14 May 2022 01:46:44 +0800
Subject: trying to modernize Perl so that dependency can be dropped

---
 scripts/identd.perl5   | 29 ++++++++++++++---------------
 scripts/sort_res.perl5 |  1 -
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/scripts/identd.perl5 b/scripts/identd.perl5
index 6662fac..cd583e0 100755
--- a/scripts/identd.perl5
+++ b/scripts/identd.perl5
@@ -18,13 +18,14 @@
 #
 # Kapil Chowksey <kchowksey@hss.hns.com>
 ###################################################################
-
+use strict;
 use Socket;
-require 'getopts.pl';
+use Getopt::Long;
 
 # Set path to lsof.
 
-if (($LSOF = &isexec("../lsof")) eq "") {	# Try .. first
+my $LSOF;
+if (($LSOF = &isexec("/usr/bin/lsof")) eq "") {	# Try .. first
     if (($LSOF = &isexec("lsof")) eq "") {	# Then try . and $PATH
 	print "can't execute $LSOF\n"; exit 1
     }
@@ -34,18 +35,16 @@ if (($LSOF = &isexec("../lsof")) eq "") {	# Try .. first
 close(STDERR);
 open(STDERR, ">/dev/null");
 
-$Timeout = "120";
+my $Timeout = "120";
 
-&Getopts('t:');
-if ($opt_t) {
-    $Timeout = $opt_t;
-}
+GetOptions('timeout=i'=>\$Timeout);
 
-($port, $iaddr) = sockaddr_in(getpeername(STDIN));
-$peer_addr = inet_ntoa($iaddr);
+my ($port, $iaddr) = sockaddr_in(getpeername(STDIN));
+my $peer_addr = inet_ntoa($iaddr);
+my $query;
 
 # read ident-query from socket (STDIN) with a timeout.
-$timeout = int($Timeout);
+my $timeout = int($Timeout);
 eval {
     local $SIG{ALRM} = sub { die "alarm\n" };
     alarm $timeout;
@@ -61,8 +60,8 @@ if ($@) {
 # remove all white-spaces from query
 $query =~ s/\s//g;
 
-$serv_port = "";
-$cli_port = "";
+my $serv_port = "";
+my $cli_port = "";
 ($serv_port,$cli_port) = split(/,/,$query);
 
 if ($serv_port =~ /^[0-9]+$/) {
@@ -87,8 +86,8 @@ if ($cli_port =~ /^[0-9]+$/) {
 
 open(LSOFP,"$LSOF -nPDi -T -FLn -iTCP@".$peer_addr.":".$cli_port."|");
 
-$user = "UNKNOWN";
-while ($a_line = <LSOFP>) {
+my $user = "UNKNOWN";
+while (my $a_line = <LSOFP>) {
     # extract user name.
     if ($a_line =~ /^L.*/) {
         ($user) = ($a_line =~ /^L(.*)/);
diff --git a/scripts/sort_res.perl5 b/scripts/sort_res.perl5
index cf11950..b3459a3 100755
--- a/scripts/sort_res.perl5
+++ b/scripts/sort_res.perl5
@@ -33,7 +33,6 @@
 #	-removing unuseful line number arg.
 #	-display global size
 
-require 'getopts.pl';
 my @args = @_;
 
 # Set path to lsof.
