about summary refs log tree commit
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2014-06-04 09:36:47 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2014-06-04 09:36:47 +0100
commitd282356dcbd6d6033c3faa48338e09621a169a5d (patch)
tree8943c519ba8d96f6310b7f3ace82edf3dee71988
parentffe94b38e1c9e3ec98aff466d9f8c03d9b4dbf04 (diff)
downloadperl-libnet-d282356dcbd6d6033c3faa48338e09621a169a5d.tar.gz
Use 5.008001, strict and warnings throughout
-rwxr-xr-xConfigure18
-rwxr-xr-xdemos/ftp19
-rwxr-xr-xdemos/nntp24
-rw-r--r--demos/nntp.mirror32
-rw-r--r--demos/pop321
-rwxr-xr-xdemos/smtp.self20
-rw-r--r--demos/time7
-rw-r--r--lib/Net/Cmd.pm11
-rw-r--r--lib/Net/Config.pm20
-rw-r--r--lib/Net/Domain.pm15
-rw-r--r--lib/Net/FTP.pm18
-rw-r--r--lib/Net/FTP/A.pm14
-rw-r--r--lib/Net/FTP/E.pm11
-rw-r--r--lib/Net/FTP/I.pm14
-rw-r--r--lib/Net/FTP/L.pm11
-rw-r--r--lib/Net/FTP/dataconn.pm13
-rw-r--r--lib/Net/NNTP.pm14
-rw-r--r--lib/Net/Netrc.pm12
-rw-r--r--lib/Net/POP3.pm31
-rw-r--r--lib/Net/SMTP.pm28
-rw-r--r--lib/Net/Time.pm18
-rw-r--r--t/config.t7
-rw-r--r--t/datasend.t9
-rw-r--r--t/external/pop3-ssl.t4
-rw-r--r--t/external/smtp-ssl.t4
-rw-r--r--t/ftp.t11
-rw-r--r--t/hostname.t11
-rw-r--r--t/libnet_t.pl4
-rw-r--r--t/netrc.t9
-rw-r--r--t/nntp.t13
-rw-r--r--t/pop3_ipv6.t7
-rw-r--r--t/pop3_ssl.t7
-rw-r--r--t/require.t7
-rw-r--r--t/smtp.t9
-rw-r--r--t/smtp_ipv6.t7
-rw-r--r--t/smtp_ssl.t7
-rw-r--r--t/time.t7
37 files changed, 322 insertions, 172 deletions
diff --git a/Configure b/Configure
index 922e5b2..9d0e0c8 100755
--- a/Configure
+++ b/Configure
@@ -1,13 +1,17 @@
-#!/usr/local/bin/perl
+#!perl
 #
 # $Id: Configure,v 1.8 1997/03/04 09:22:32 gbarr Exp $
 
+use 5.008001;
+
 use strict;
-use IO::File;
-use Getopt::Std;
+use warnings;
+
 use ExtUtils::MakeMaker qw(prompt);
+use Getopt::Std;
+use IO::File;
 
-use vars qw($opt_d $opt_o);
+our($opt_d, $opt_o);
 
 ##
 ##
@@ -240,7 +244,10 @@ $libnet_cfg = "libnet.cfg"
 
 my %oldcfg = ();
 
+{
+no warnings 'once';
 $Net::Config::CONFIGURE = 1; # Suppress load of user overrides
+}
 if( -f $libnet_cfg )
  {
   %oldcfg = ( %{ do $libnet_cfg } );
@@ -248,7 +255,10 @@ if( -f $libnet_cfg )
 elsif (eval { require Net::Config })
  {
   $have_old = 1;
+  {
+  no warnings 'once';
   %oldcfg = %Net::Config::NetConfig;
+  }
  }
 
 map { $cfg{lc $_} = $cfg{$_}; delete $cfg{$_} if /[A-Z]/ } keys %cfg;
diff --git a/demos/ftp b/demos/ftp
index 610e102..aff60aa 100755
--- a/demos/ftp
+++ b/demos/ftp
@@ -1,19 +1,24 @@
-#!/usr/local/bin/perl
+#!perl
+
+use 5.008001;
+
+use strict;
+use warnings;
 
 use blib;
-use Net::FTP;
 use Getopt::Long;
+use Net::FTP;
 
-$opt_debug = undef;
-$opt_firewall = undef;
+our $opt_debug = undef;
+our $opt_firewall = undef;
 
 GetOptions(qw(debug firewall=s));
 
-@firewall = defined $opt_firewall ? (Firewall => $opt_firewall) : ();
+my @firewall = defined $opt_firewall ? (Firewall => $opt_firewall) : ();
 
-foreach $host (@ARGV)
+foreach my $host (@ARGV)
  {
-  $ftp = Net::FTP->new($host, @firewall, Debug => $opt_debug ? 1 : 0);
+  my $ftp = Net::FTP->new($host, @firewall, Debug => $opt_debug ? 1 : 0);
   $ftp->login();
   print $ftp->pwd,"\n";
   $ftp->quit;
diff --git a/demos/nntp b/demos/nntp
index 7753fbc..6f75f82 100755
--- a/demos/nntp
+++ b/demos/nntp
@@ -1,17 +1,23 @@
-#!/usr/local/bin/perl
+#!perl
+
+use 5.008001;
+
+use strict;
+use warnings;
 
 use blib;
 use Getopt::Long;
 use Net::NNTP;
 
-$opt_debug = undef;
+our $opt_debug = undef;
 
 GetOptions(qw(debug));
 
-@groups = @ARGV;
+my @groups = @ARGV;
 
-$nntp = Net::NNTP->new('news', Debug => $opt_debug ? 1 : 0);
+my $nntp = Net::NNTP->new('news', Debug => $opt_debug ? 1 : 0);
 
+my $subs;
 if($subs = $nntp->newsgroups)
  {
   print join("\n",(keys %$subs)[0 .. 10]),"\n";
@@ -21,14 +27,14 @@ if($subs = $nntp->newsgroups)
   warn $nntp->message;
  }
 
-foreach $group (@groups)
+foreach my $group (@groups)
  {
-  $new = $nntp->newnews(time - 3600, lc $group);
+  my $news = $nntp->newnews(time - 3600, lc $group);
 
-  if(ref($new) && scalar(@$new))
+  if(ref($news) && scalar(@$news))
    {
-    print@{$news}[0..3],"\n"
-        if $news = $nntp->article($new->[-1]);
+    print @{$news}[0..3],"\n"
+        if $news = $nntp->article($news->[-1]);
 
     warn $nntp->message
          unless $news;
diff --git a/demos/nntp.mirror b/demos/nntp.mirror
index 8a43c32..0976a38 100644
--- a/demos/nntp.mirror
+++ b/demos/nntp.mirror
@@ -1,4 +1,4 @@
-#!/usr/bin/perl5
+#!perl
 
 ### Subject: Re: Fuller example of Net::NNTP?
 ### Date:  Tue, 4 Feb 1997 10:37:58 -0800
@@ -20,9 +20,14 @@
 ### work on every system
 ###
 
+use 5.008001;
+
+use strict;
+use warnings;
+
 use Net::NNTP;
 
-$BaseDir = '/usr/usenet';
+my $BaseDir = '/usr/usenet';
 chdir($BaseDir) or die "Could not cd to $BaseDir\n";
 
 # Format of grouplist is:
@@ -31,17 +36,18 @@ chdir($BaseDir) or die "Could not cd to $BaseDir\n";
 #    set it to 0 if you want the articles to stay forever
 # If the groupname starts with a #, it is skipped
 open(GROUPLIST, 'grouplist.txt') or die "Could not open grouplist.txt\n";
+my @Groups;
 while(<GROUPLIST>) {
-        $Line = $_; chomp($Line);
+        my $Line = $_; chomp($Line);
         if($Line eq '') { next };  # Skip blank lines
         if(substr($Line, 0, 1) eq '#') { next };  # Skip comments
         push(@Groups, $Line)
 }
 
-$NntpPtr = Net::NNTP->new('news.server.com');
+my $NntpPtr = Net::NNTP->new('news.server.com');
 
-foreach $GroupLine (@Groups) {
-        ($GroupName, $GroupExp) = split(/\s/, $GroupLine, 2);
+foreach my $GroupLine (@Groups) {
+        my($GroupName, $GroupExp) = split(/\s/, $GroupLine, 2);
         # Process the expiration first (still to be done...)
 
         # See if this is a new group
@@ -51,25 +57,27 @@ foreach $GroupLine (@Groups) {
         }
         chdir("$BaseDir/$GroupName") or die "Couldn't chdir to $GroupName\n";
         # Find the last article in the directory
-        @AllInDir = <*>; @RevSortedAllInDir = reverse(sort(@AllInDir));
-        $LenArr = @RevSortedAllInDir;
+        my @AllInDir = <*>; my @RevSortedAllInDir = reverse(sort(@AllInDir));
+        my $LenArr = @RevSortedAllInDir;
+        my $NumLastInDir;
         if($LenArr > 0) { $NumLastInDir = $RevSortedAllInDir[0] }
         else { $NumLastInDir = 0 }
-        ($NumArt, $NumFirst, $NumLast, $XGroupName) =
-$NntpPtr->group($GroupName);
+        my($NumArt, $NumFirst, $NumLast, $XGroupName) =
+                $NntpPtr->group($GroupName);
 
         if($NumLast == $NumLastInDir) { next }  # No new articles
         if($NumLast < $NumLastInDir)
                 { die "In $GroupName, the last number was $NumLast, but the " .
                         " last number in the directory was $NumLastInDir\n" }
         # Figure out which article to start from
+        my $GetArtNum;
         if($NumLastInDir == 0) { $GetArtNum = $NumFirst }
         else { $GetArtNum = $NumLastInDir + 1 }
 
         # Now read each of the new articles
         while(1) {  # Loop until "last" is called
-                $ArtRef = $NntpPtr->article($GetArtNum);
-                @ArtArr = @$ArtRef; $ArtArrLen = @ArtArr;
+                my $ArtRef = $NntpPtr->article($GetArtNum);
+                my @ArtArr = @$ArtRef; my $ArtArrLen = @ArtArr;
                 if($ArtArrLen > 0 ) {  # Skip article numbers that had 0 len
                         open(OUT, ">$GetArtNum") or
                                 die "Could not create $GroupName/$GetArtNum\n";
diff --git a/demos/pop3 b/demos/pop3
index 0ae07ae..28399cd 100644
--- a/demos/pop3
+++ b/demos/pop3
@@ -1,23 +1,28 @@
-#!/usr/local/bin/perl -w
+#!perl
+
+use 5.008001;
+
+use strict;
+use warnings;
 
 use blib;
-use Net::POP3;
 use Getopt::Long;
+use Net::POP3;
 
-$opt_debug = 0;
-$opt_user = undef;
+my $opt_debug = 0;
+my $opt_user = undef;
 
 GetOptions(qw(debug user=s));
 
-$pop = Net::POP3->new('backup3', Debug => $opt_debug ? 6 : 0);
+my $pop = Net::POP3->new('backup3', Debug => $opt_debug ? 6 : 0);
 
-$user = $opt_user || $ENV{USER} || $ENV{LOGNAME};
+my $user = $opt_user || $ENV{USER} || $ENV{LOGNAME};
 
-$count = $pop->login($user);
+my $count = $pop->login($user);
 
 if($count)
  {
-  $m = $pop->get(1);
+  my $m = $pop->get(1);
   print @$m if $m;
  }
 
diff --git a/demos/smtp.self b/demos/smtp.self
index 5cfbc2b..10200ea 100755
--- a/demos/smtp.self
+++ b/demos/smtp.self
@@ -1,8 +1,13 @@
-#!/usr/local/bin/perl -w
+#!perl
+
+use 5.008001;
+
+use strict;
+use warnings;
 
 use blib;
-use Net::SMTP;
 use Getopt::Long;
+use Net::SMTP;
 
 =head1 NAME
 
@@ -38,9 +43,9 @@ Send the message to C<USERNAME>
 
 =cut
 
-$opt_debug = undef;
-$opt_user = undef;
-$opt_help = undef;
+my $opt_debug = undef;
+my $opt_user = undef;
+my $opt_help = undef;
 GetOptions(qw(debug user=s help));
 
 exec("pod2text $0")
@@ -48,9 +53,9 @@ exec("pod2text $0")
 
 Net::SMTP->debug(1) if $opt_debug;
 
-$smtp = Net::SMTP->new("mailhost");
+my $smtp = Net::SMTP->new("mailhost");
 
-$user = $opt_user || $ENV{USER} || $ENV{LOGNAME};
+my $user = $opt_user || $ENV{USER} || $ENV{LOGNAME};
 
 $smtp->mail($user) && $smtp->to($user);
 $smtp->reset;
@@ -59,6 +64,7 @@ if($smtp->mail($user) && $smtp->to($user))
  {
   $smtp->data();
 
+  my @data;
   map { s/-USER-/$user/g } @data=<DATA>;
 
   $smtp->datasend(@data);
diff --git a/demos/time b/demos/time
index 61095d3..d87bafd 100644
--- a/demos/time
+++ b/demos/time
@@ -1,4 +1,9 @@
-#!/usr/local/bin/perl -w
+#!perl
+
+use 5.008001;
+
+use strict;
+use warnings;
 
 use blib;
 use Net::Time qw(inet_time inet_daytime);
diff --git a/lib/Net/Cmd.pm b/lib/Net/Cmd.pm
index 06191d7..48aea55 100644
--- a/lib/Net/Cmd.pm
+++ b/lib/Net/Cmd.pm
@@ -7,11 +7,12 @@
 package Net::Cmd;
 
 use 5.008001;
-require Exporter;
 
 use strict;
-use vars qw(@ISA @EXPORT $VERSION);
+use warnings;
+
 use Carp;
+use Exporter;
 use Symbol 'gensym';
 
 BEGIN {
@@ -37,9 +38,9 @@ BEGIN {
   }
 }
 
-$VERSION = "2.31";
-@ISA     = qw(Exporter);
-@EXPORT  = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING);
+our $VERSION = "2.31";
+our @ISA     = qw(Exporter);
+our @EXPORT  = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING);
 
 
 sub CMD_INFO    {1}
diff --git a/lib/Net/Config.pm b/lib/Net/Config.pm
index f9d04e1..c0ed9a0 100644
--- a/lib/Net/Config.pm
+++ b/lib/Net/Config.pm
@@ -6,18 +6,23 @@
 
 package Net::Config;
 
-require Exporter;
-use vars qw(@ISA @EXPORT %NetConfig $VERSION $CONFIGURE $LIBNET_CFG);
-use Socket qw(inet_aton inet_ntoa);
+use 5.008001;
+
 use strict;
+use warnings;
+
+use Exporter;
+use Socket qw(inet_aton inet_ntoa);
+
+our @EXPORT  = qw(%NetConfig);
+our @ISA     = qw(Net::LocalCfg Exporter);
+our $VERSION = "1.15";
 
-@EXPORT  = qw(%NetConfig);
-@ISA     = qw(Net::LocalCfg Exporter);
-$VERSION = "1.14";
+our($CONFIGURE, $LIBNET_CFG);
 
 eval { local $SIG{__DIE__}; require Net::LocalCfg };
 
-%NetConfig = (
+our %NetConfig = (
   nntp_hosts      => [],
   snpp_hosts      => [],
   pop3_hosts      => [],
@@ -112,7 +117,6 @@ sub requires_firewall {
   return 0;
 }
 
-use vars qw(*is_external);
 *is_external = \&requires_firewall;
 
 1;
diff --git a/lib/Net/Domain.pm b/lib/Net/Domain.pm
index 5b964c3..f3d1772 100644
--- a/lib/Net/Domain.pm
+++ b/lib/Net/Domain.pm
@@ -6,17 +6,18 @@
 
 package Net::Domain;
 
-require Exporter;
+use 5.008001;
 
-use Carp;
 use strict;
-use vars qw($VERSION @ISA @EXPORT_OK);
-use Net::Config;
+use warnings;
 
-@ISA       = qw(Exporter);
-@EXPORT_OK = qw(hostname hostdomain hostfqdn domainname);
+use Carp;
+use Exporter;
+use Net::Config;
 
-$VERSION = "2.23";
+our @ISA       = qw(Exporter);
+our @EXPORT_OK = qw(hostname hostdomain hostfqdn domainname);
+our $VERSION = "2.24";
 
 my ($host, $domain, $fqdn) = (undef, undef, undef);
 
diff --git a/lib/Net/FTP.pm b/lib/Net/FTP.pm
index eb7494e..3a4af03 100644
--- a/lib/Net/FTP.pm
+++ b/lib/Net/FTP.pm
@@ -11,34 +11,30 @@ package Net::FTP;
 use 5.008001;
 
 use strict;
-use vars qw(@ISA $VERSION);
+use warnings;
 use Carp;
 
-use Socket 1.3;
+use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC);
 use IO::Socket;
-use Time::Local;
 use Net::Cmd;
 use Net::Config;
-use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC);
+use Socket 1.3;
+use Time::Local;
 
-$VERSION = '2.80';
-@ISA     = qw(Exporter Net::Cmd IO::Socket::INET);
+our $VERSION = '2.80';
+our @ISA     = qw(Exporter Net::Cmd IO::Socket::INET);
 
 # Someday I will "use constant", when I am not bothered to much about
 # compatibility with older releases of perl
 
-use vars qw($TELNET_IAC $TELNET_IP $TELNET_DM);
-($TELNET_IAC, $TELNET_IP, $TELNET_DM) = (255, 244, 242);
-
+our($TELNET_IAC, $TELNET_IP, $TELNET_DM) = (255, 244, 242);
 
 BEGIN {
-
   # make a constant so code is fast'ish
   my $is_os390 = $^O eq 'os390';
   *trEBCDIC = sub () {$is_os390}
 }
 
-
 sub new {
   my $pkg = shift;
   my ($peer, %arg);
diff --git a/lib/Net/FTP/A.pm b/lib/Net/FTP/A.pm
index c117d69..6940bc2 100644
--- a/lib/Net/FTP/A.pm
+++ b/lib/Net/FTP/A.pm
@@ -3,15 +3,19 @@
 ##
 
 package Net::FTP::A;
+
+use 5.008001;
+
 use strict;
-use vars qw(@ISA $buf $VERSION);
-use Carp;
+use warnings;
 
-require Net::FTP::dataconn;
+use Carp;
+use Net::FTP::dataconn;
 
-@ISA     = qw(Net::FTP::dataconn);
-$VERSION = "1.19";
+our @ISA     = qw(Net::FTP::dataconn);
+our $VERSION = "1.20";
 
+our $buf;
 
 sub read {
   my $data = shift;
diff --git a/lib/Net/FTP/E.pm b/lib/Net/FTP/E.pm
index d480cd7..dd96e3b 100644
--- a/lib/Net/FTP/E.pm
+++ b/lib/Net/FTP/E.pm
@@ -1,8 +1,13 @@
 package Net::FTP::E;
 
-require Net::FTP::I;
+use 5.008001;
 
-@ISA = qw(Net::FTP::I);
-$VERSION = "0.01";
+use strict;
+use warnings;
+
+use Net::FTP::I;
+
+our @ISA = qw(Net::FTP::I);
+our $VERSION = "0.02";
 
 1;
diff --git a/lib/Net/FTP/I.pm b/lib/Net/FTP/I.pm
index 449bb99..0e9e5ff 100644
--- a/lib/Net/FTP/I.pm
+++ b/lib/Net/FTP/I.pm
@@ -4,14 +4,18 @@
 
 package Net::FTP::I;
 
-use vars qw(@ISA $buf $VERSION);
-use Carp;
+use 5.008001;
+
+use strict;
+use warnings;
 
-require Net::FTP::dataconn;
+use Carp;
+use Net::FTP::dataconn;
 
-@ISA     = qw(Net::FTP::dataconn);
-$VERSION = "1.12";
+our @ISA     = qw(Net::FTP::dataconn);
+our $VERSION = "1.13";
 
+our $buf;
 
 sub read {
   my $data = shift;
diff --git a/lib/Net/FTP/L.pm b/lib/Net/FTP/L.pm
index f7423cb..b0858e0 100644
--- a/lib/Net/FTP/L.pm
+++ b/lib/Net/FTP/L.pm
@@ -1,8 +1,13 @@
 package Net::FTP::L;
 
-require Net::FTP::I;
+use 5.008001;
 
-@ISA = qw(Net::FTP::I);
-$VERSION = "0.01";
+use strict;
+use warnings;
+
+use Net::FTP::I;
+
+our @ISA = qw(Net::FTP::I);
+our $VERSION = "0.02";
 
 1;
diff --git a/lib/Net/FTP/dataconn.pm b/lib/Net/FTP/dataconn.pm
index 3f93668..76ea14a 100644
--- a/lib/Net/FTP/dataconn.pm
+++ b/lib/Net/FTP/dataconn.pm
@@ -4,14 +4,17 @@
 
 package Net::FTP::dataconn;
 
+use 5.008001;
+
+use strict;
+use warnings;
+
 use Carp;
-use vars qw(@ISA $timeout $VERSION);
-use Net::Cmd;
 use Errno;
+use Net::Cmd;
 
-$VERSION = '0.12';
-@ISA     = qw(IO::Socket::INET);
-
+our $VERSION = '0.13';
+our @ISA     = qw(IO::Socket::INET);
 
 sub reading {
   my $data = shift;
diff --git a/lib/Net/NNTP.pm b/lib/Net/NNTP.pm
index 07c3737..ee023f4 100644
--- a/lib/Net/NNTP.pm
+++ b/lib/Net/NNTP.pm
@@ -6,17 +6,19 @@
 
 package Net::NNTP;
 
+use 5.008001;
+
 use strict;
-use vars qw(@ISA $VERSION $debug);
+use warnings;
+
+use Carp;
 use IO::Socket;
 use Net::Cmd;
-use Carp;
-use Time::Local;
 use Net::Config;
+use Time::Local;
 
-$VERSION = "2.26";
-@ISA     = qw(Net::Cmd IO::Socket::INET);
-
+our $VERSION = "2.27";
+our @ISA     = qw(Net::Cmd IO::Socket::INET);
 
 sub new {
   my $self = shift;
diff --git a/lib/Net/Netrc.pm b/lib/Net/Netrc.pm
index fbe8d6d..826d386 100644
--- a/lib/Net/Netrc.pm
+++ b/lib/Net/Netrc.pm
@@ -6,15 +6,19 @@
 
 package Net::Netrc;
 
-use Carp;
+use 5.008001;
+
 use strict;
+use warnings;
+
+use Carp;
 use FileHandle;
-use vars qw($VERSION $TESTING);
 
-$VERSION = "2.14";
+our $VERSION = "2.15";
 
-my %netrc = ();
+our $TESTING;
 
+my %netrc = ();
 
 sub _readrc {
   my $host = shift;
diff --git a/lib/Net/POP3.pm b/lib/Net/POP3.pm
index f51f0cf..186ef81 100644
--- a/lib/Net/POP3.pm
+++ b/lib/Net/POP3.pm
@@ -6,42 +6,41 @@
 
 package Net::POP3;
 
+use 5.008001;
+
 use strict;
+use warnings;
+
+use Carp;
 use IO::Socket;
-use vars qw(@ISA $VERSION $debug);
 use Net::Cmd;
-use Carp;
 use Net::Config;
 
-$VERSION = "2.32";
+our $VERSION = "2.32";
 
-@ISA = qw(Net::Cmd IO::Socket::INET);
 # Code for detecting if we can use SSL
 my $ssl_class = eval {
   require IO::Socket::SSL;
   # first version with default CA on most platforms
   IO::Socket::SSL->VERSION(1.968);
 } && 'IO::Socket::SSL';
+
 my $nossl_warn = !$ssl_class &&
   'To use SSL please install IO::Socket::SSL with version>=1.968';
 
 # Code for detecting if we can use IPv6
-my $inet6_class =
-  eval {
-    require IO::Socket::IP;
-    IO::Socket::IP->VERSION(0.20);
-  } && 'IO::Socket::IP' ||
-  eval {
-    require IO::Socket::INET6;
-    IO::Socket::INET6->VERSION(2.62);
-  } && 'IO::Socket::INET6';
+my $inet6_class = eval {
+  require IO::Socket::IP;
+  IO::Socket::IP->VERSION(0.20);
+} && 'IO::Socket::IP' || eval {
+  require IO::Socket::INET6;
+  IO::Socket::INET6->VERSION(2.62);
+} && 'IO::Socket::INET6';
 
 sub can_ssl   { $ssl_class };
 sub can_inet6 { $inet6_class };
 
-
-@ISA = ( 'Net::Cmd', $inet6_class || 'IO::Socket::INET' );
-
+our @ISA = ('Net::Cmd', $inet6_class || 'IO::Socket::INET');
 
 sub new {
   my $self = shift;
diff --git a/lib/Net/SMTP.pm b/lib/Net/SMTP.pm
index 6c81b9a..315a52b 100644
--- a/lib/Net/SMTP.pm
+++ b/lib/Net/SMTP.pm
@@ -9,14 +9,15 @@ package Net::SMTP;
 use 5.008001;
 
 use strict;
-use vars qw($VERSION @ISA);
-use Socket 1.3;
+use warnings;
+
 use Carp;
 use IO::Socket;
 use Net::Cmd;
 use Net::Config;
+use Socket 1.3;
 
-$VERSION = "2.35";
+our $VERSION = "2.35";
 
 # Code for detecting if we can use SSL
 my $ssl_class = eval {
@@ -24,26 +25,23 @@ my $ssl_class = eval {
   # first version with default CA on most platforms
   IO::Socket::SSL->VERSION(1.968);
 } && 'IO::Socket::SSL';
+
 my $nossl_warn = !$ssl_class &&
   'To use SSL please install IO::Socket::SSL with version>=1.968';
 
 # Code for detecting if we can use IPv6
-my $inet6_class =
-  eval {
-    require IO::Socket::IP;
-    IO::Socket::IP->VERSION(0.20);
-  } && 'IO::Socket::IP' ||
-  eval {
-    require IO::Socket::INET6;
-    IO::Socket::INET6->VERSION(2.62);
-  } && 'IO::Socket::INET6';
+my $inet6_class = eval {
+  require IO::Socket::IP;
+  IO::Socket::IP->VERSION(0.20);
+} && 'IO::Socket::IP' || eval {
+  require IO::Socket::INET6;
+  IO::Socket::INET6->VERSION(2.62);
+} && 'IO::Socket::INET6';
 
 sub can_ssl   { $ssl_class };
 sub can_inet6 { $inet6_class };
 
-
-@ISA = ( 'Net::Cmd', $inet6_class || 'IO::Socket::INET' );
-
+our @ISA = ('Net::Cmd', $inet6_class || 'IO::Socket::INET');
 
 sub new {
   my $self = shift;
diff --git a/lib/Net/Time.pm b/lib/Net/Time.pm
index 6b3b641..7b59805 100644
--- a/lib/Net/Time.pm
+++ b/lib/Net/Time.pm
@@ -6,21 +6,23 @@
 
 package Net::Time;
 
+use 5.008001;
+
 use strict;
-use vars qw($VERSION @ISA @EXPORT_OK $TIMEOUT);
+use warnings;
+
 use Carp;
+use Exporter;
+use IO::Select;
 use IO::Socket;
-require Exporter;
 use Net::Config;
-use IO::Select;
-
-@ISA       = qw(Exporter);
-@EXPORT_OK = qw(inet_time inet_daytime);
 
-$VERSION = "2.11";
+our @ISA       = qw(Exporter);
+our @EXPORT_OK = qw(inet_time inet_daytime);
 
-$TIMEOUT = 120;
+our $VERSION = "2.12";
 
+our $TIMEOUT = 120;
 
 sub _socket {
   my ($pname, $pnum, $host, $proto, $timeout) = @_;
diff --git a/t/config.t b/t/config.t
index 3a34251..be508e3 100644
--- a/t/config.t
+++ b/t/config.t
@@ -1,4 +1,9 @@
-#!./perl -w
+#!perl
+
+use 5.008001;
+
+use strict;
+use warnings;
 
 BEGIN {
     if ($ENV{PERL_CORE}) {
diff --git a/t/datasend.t b/t/datasend.t
index f642340..1c4a0c7 100644
--- a/t/datasend.t
+++ b/t/datasend.t
@@ -1,4 +1,9 @@
-#!./perl -w
+#!perl
+
+use 5.008001;
+
+use strict;
+use warnings;
 
 BEGIN {
     if ($ENV{PERL_CORE}) {
@@ -18,7 +23,7 @@ BEGIN {
 
   use IO::File;
   use Net::Cmd;
-  @ISA = qw(Net::Cmd IO::File);
+  our @ISA = qw(Net::Cmd IO::File);
 
   sub timeout { 0 }
 
diff --git a/t/external/pop3-ssl.t b/t/external/pop3-ssl.t
index 6eec93c..554a8db 100644
--- a/t/external/pop3-ssl.t
+++ b/t/external/pop3-ssl.t
@@ -1,6 +1,10 @@
+#!perl
+
+use 5.008001;
 
 use strict;
 use warnings;
+
 use Net::POP3;
 use Test::More;
 
diff --git a/t/external/smtp-ssl.t b/t/external/smtp-ssl.t
index 1802976..ccacbae 100644
--- a/t/external/smtp-ssl.t
+++ b/t/external/smtp-ssl.t
@@ -1,6 +1,10 @@
+#!perl
+
+use 5.008001;
 
 use strict;
 use warnings;
+
 use Net::SMTP;
 use Test::More;
 
diff --git a/t/ftp.t b/t/ftp.t
index 0c1b0e3..7ee4623 100644
--- a/t/ftp.t
+++ b/t/ftp.t
@@ -1,4 +1,9 @@
-#!./perl -w
+#!perl
+
+use 5.008001;
+
+use strict;
+use warnings;
 
 BEGIN {
     unless (-d 'blib') {
@@ -29,7 +34,7 @@ unless($NetConfig{test_hosts}) {
 my $t = 1;
 print "1..7\n";
 
-$ftp = Net::FTP->new($NetConfig{ftp_testhost})
+my $ftp = Net::FTP->new($NetConfig{ftp_testhost})
         or (print("not ok 1\n"), exit);
 
 printf "ok %d\n",$t++;
@@ -49,12 +54,14 @@ $ftp->cwd('/pub') or do {
   print "not ";
 };
 
+my $data;
 if ($data = $ftp->stor('libnet.tst')) {
   my $text = "abc\ndef\nqwe\n";
   printf "ok %d\n",$t++;
   $data->write($text,length $text);
   $data->close;
   $data = $ftp->retr('libnet.tst');
+  my $buf;
   $data->read($buf,length $text);
   $data->close;
   print "not " unless $text eq $buf;
diff --git a/t/hostname.t b/t/hostname.t
index f486bb4..e831b2d 100644
--- a/t/hostname.t
+++ b/t/hostname.t
@@ -1,4 +1,9 @@
-#!./perl -w
+#!perl
+
+use 5.008001;
+
+use strict;
+use warnings;
 
 BEGIN {
     unless (-d 'blib') {
@@ -23,7 +28,7 @@ unless($NetConfig{test_hosts}) {
 
 print "1..5\n";
 
-$domain = domainname();
+my $domain = domainname();
 
 if(defined $domain && $domain ne "") {
  print "ok 1 - defined, non-empty domainname\n";
@@ -52,7 +57,7 @@ my @dummy = grep { defined hostname() and hostname() eq $_ } @domain;
   : print "not ok 3\n";
 
 my $name = hostname();
-my $domain = hostdomain();
+$domain = hostdomain();
 if(defined $domain && defined $name && $name ne "" && $domain ne "") {
     hostfqdn() eq $name . "." . $domain ? print "ok 4\n" : print "not ok 4\n";
     domainname() eq $name . "." . $domain ? print "ok 5\n" : print "not ok 5\n";} else {
diff --git a/t/libnet_t.pl b/t/libnet_t.pl
index 9337dd1..cc512ca 100644
--- a/t/libnet_t.pl
+++ b/t/libnet_t.pl
@@ -1,3 +1,7 @@
+use 5.008001;
+
+use strict;
+use warnings;
 
 my $number = 0;
 sub ok {
diff --git a/t/netrc.t b/t/netrc.t
index bb97244..d06cf90 100644
--- a/t/netrc.t
+++ b/t/netrc.t
@@ -1,4 +1,9 @@
-#!./perl
+#!perl
+
+use 5.008001;
+
+use strict;
+use warnings;
 
 BEGIN {
     if ($ENV{PERL_CORE}) {
@@ -13,8 +18,6 @@ BEGIN {
     }
 }
 
-use strict;
-
 use Cwd;
 print "1..20\n";
 
diff --git a/t/nntp.t b/t/nntp.t
index 643cfc8..a084045 100644
--- a/t/nntp.t
+++ b/t/nntp.t
@@ -1,4 +1,9 @@
-#!./perl -w
+#!perl
+
+use 5.008001;
+
+use strict;
+use warnings;
 
 BEGIN {
     unless (-d 'blib') {
@@ -26,13 +31,13 @@ print "1..4\n";
 
 my $i = 1;
 
-$nntp = Net::NNTP->new(Debug => 0)
+my $nntp = Net::NNTP->new(Debug => 0)
         or (print("not ok 1\n"), exit);
 
 print "ok 1\n";
 
-my $grp;
-foreach $grp (qw(test alt.test control news.announce.newusers)) {
+my @grp;
+foreach my $grp (qw(test alt.test control news.announce.newusers)) {
     @grp = $nntp->group($grp);
     last if @grp;
 }
diff --git a/t/pop3_ipv6.t b/t/pop3_ipv6.t
index 2f073ab..9b3c8cb 100644
--- a/t/pop3_ipv6.t
+++ b/t/pop3_ipv6.t
@@ -1,8 +1,13 @@
+#!perl
+
+use 5.008001;
+
 use strict;
 use warnings;
-use Test::More;
+
 use File::Temp 'tempfile';
 use Net::POP3;
+use Test::More;
 
 my $debug = 0; # Net::POP3->new( Debug => .. )
 
diff --git a/t/pop3_ssl.t b/t/pop3_ssl.t
index 08ef266..3ba74af 100644
--- a/t/pop3_ssl.t
+++ b/t/pop3_ssl.t
@@ -1,8 +1,13 @@
+#!perl
+
+use 5.008001;
+
 use strict;
 use warnings;
-use Test::More;
+
 use File::Temp 'tempfile';
 use Net::POP3;
+use Test::More;
 
 my $debug = 0; # Net::POP3 Debug => ..
 
diff --git a/t/require.t b/t/require.t
index 973ed41..d7f839d 100644
--- a/t/require.t
+++ b/t/require.t
@@ -1,4 +1,9 @@
-#!./perl -w
+#!perl
+
+use 5.008001;
+
+use strict;
+use warnings;
 
 BEGIN {
     unless (-d 'blib') {
diff --git a/t/smtp.t b/t/smtp.t
index 6daef31..5bd1966 100644
--- a/t/smtp.t
+++ b/t/smtp.t
@@ -1,4 +1,9 @@
-#!./perl -w
+#!perl
+
+use 5.008001;
+
+use strict;
+use warnings;
 
 BEGIN {
     unless (-d 'blib') {
@@ -25,7 +30,7 @@ print "1..3\n";
 
 my $i = 1;
 
-$smtp = Net::SMTP->new(Debug => 0)
+my $smtp = Net::SMTP->new(Debug => 0)
         or (print("not ok 1\n"), exit);
 
 print "ok 1\n";
diff --git a/t/smtp_ipv6.t b/t/smtp_ipv6.t
index 6a01520..6e4a990 100644
--- a/t/smtp_ipv6.t
+++ b/t/smtp_ipv6.t
@@ -1,8 +1,13 @@
+#!perl
+
+use 5.008001;
+
 use strict;
 use warnings;
-use Test::More;
+
 use File::Temp 'tempfile';
 use Net::SMTP;
+use Test::More;
 
 my $debug = 0; # Net::SMTP->new( Debug => .. )
 
diff --git a/t/smtp_ssl.t b/t/smtp_ssl.t
index e7391f3..b7a533f 100644
--- a/t/smtp_ssl.t
+++ b/t/smtp_ssl.t
@@ -1,8 +1,13 @@
+#!perl
+
+use 5.008001;
+
 use strict;
 use warnings;
-use Test::More;
+
 use File::Temp 'tempfile';
 use Net::SMTP;
+use Test::More;
 
 my $debug = 0; # Net::SMTP Debug => ..
 
diff --git a/t/time.t b/t/time.t
index 224b640..07712fb 100644
--- a/t/time.t
+++ b/t/time.t
@@ -1,4 +1,9 @@
-#!./perl -w
+#!perl
+
+use 5.008001;
+
+use strict;
+use warnings;
 
 BEGIN {
     if ($ENV{PERL_CORE}) {