Author: Nicholas Bamber <nicholas@periapt.co.uk>
Subject: trying to modernize Perl so that dependency can be dropped
Forwarded: not-needed
Last-Update: 2012-05-05
--- 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 @@
 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 @@
 # 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 @@
 
 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(.*)/);
--- 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.
