diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2014-06-04 09:36:47 +0100 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2014-06-04 09:36:47 +0100 |
commit | d282356dcbd6d6033c3faa48338e09621a169a5d (patch) | |
tree | 8943c519ba8d96f6310b7f3ace82edf3dee71988 | |
parent | ffe94b38e1c9e3ec98aff466d9f8c03d9b4dbf04 (diff) | |
download | perl-libnet-d282356dcbd6d6033c3faa48338e09621a169a5d.tar.gz |
Use 5.008001, strict and warnings throughout
-rwxr-xr-x | Configure | 18 | ||||
-rwxr-xr-x | demos/ftp | 19 | ||||
-rwxr-xr-x | demos/nntp | 24 | ||||
-rw-r--r-- | demos/nntp.mirror | 32 | ||||
-rw-r--r-- | demos/pop3 | 21 | ||||
-rwxr-xr-x | demos/smtp.self | 20 | ||||
-rw-r--r-- | demos/time | 7 | ||||
-rw-r--r-- | lib/Net/Cmd.pm | 11 | ||||
-rw-r--r-- | lib/Net/Config.pm | 20 | ||||
-rw-r--r-- | lib/Net/Domain.pm | 15 | ||||
-rw-r--r-- | lib/Net/FTP.pm | 18 | ||||
-rw-r--r-- | lib/Net/FTP/A.pm | 14 | ||||
-rw-r--r-- | lib/Net/FTP/E.pm | 11 | ||||
-rw-r--r-- | lib/Net/FTP/I.pm | 14 | ||||
-rw-r--r-- | lib/Net/FTP/L.pm | 11 | ||||
-rw-r--r-- | lib/Net/FTP/dataconn.pm | 13 | ||||
-rw-r--r-- | lib/Net/NNTP.pm | 14 | ||||
-rw-r--r-- | lib/Net/Netrc.pm | 12 | ||||
-rw-r--r-- | lib/Net/POP3.pm | 31 | ||||
-rw-r--r-- | lib/Net/SMTP.pm | 28 | ||||
-rw-r--r-- | lib/Net/Time.pm | 18 | ||||
-rw-r--r-- | t/config.t | 7 | ||||
-rw-r--r-- | t/datasend.t | 9 | ||||
-rw-r--r-- | t/external/pop3-ssl.t | 4 | ||||
-rw-r--r-- | t/external/smtp-ssl.t | 4 | ||||
-rw-r--r-- | t/ftp.t | 11 | ||||
-rw-r--r-- | t/hostname.t | 11 | ||||
-rw-r--r-- | t/libnet_t.pl | 4 | ||||
-rw-r--r-- | t/netrc.t | 9 | ||||
-rw-r--r-- | t/nntp.t | 13 | ||||
-rw-r--r-- | t/pop3_ipv6.t | 7 | ||||
-rw-r--r-- | t/pop3_ssl.t | 7 | ||||
-rw-r--r-- | t/require.t | 7 | ||||
-rw-r--r-- | t/smtp.t | 9 | ||||
-rw-r--r-- | t/smtp_ipv6.t | 7 | ||||
-rw-r--r-- | t/smtp_ssl.t | 7 | ||||
-rw-r--r-- | t/time.t | 7 |
37 files changed, 322 insertions, 172 deletions
@@ -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; @@ -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; @@ -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"; @@ -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); @@ -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) = @_; @@ -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; @@ -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 { @@ -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"; @@ -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') { @@ -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 => .. @@ -1,4 +1,9 @@ -#!./perl -w +#!perl + +use 5.008001; + +use strict; +use warnings; BEGIN { if ($ENV{PERL_CORE}) { |