diff options
-rw-r--r-- | Changes | 15 | ||||
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | Makefile.PL | 6 | ||||
-rw-r--r-- | Net/Cmd.pm | 2 | ||||
-rw-r--r-- | Net/Config.pm | 2 | ||||
-rw-r--r-- | Net/FTP.pm | 2 | ||||
-rw-r--r-- | Net/FTP/dataconn.pm | 2 | ||||
-rw-r--r-- | Net/Netrc.pm | 2 | ||||
-rw-r--r-- | Net/POP3.pm | 2 | ||||
-rw-r--r-- | Net/SMTP.pm | 2 | ||||
-rw-r--r-- | Net/libnetFAQ.pod | 17 | ||||
-rw-r--r-- | README | 16 | ||||
-rw-r--r-- | t/hostname.t | 5 | ||||
-rw-r--r-- | t/time.t | 133 |
14 files changed, 181 insertions, 26 deletions
@@ -1,3 +1,18 @@ +libnet 1.22_02 -- Thu Aug 08 2013 + + * Make Net::FTP::dataconn::close() more robust [Together with changes to + Net::FTP already made in 1.22_01, this resolves CPAN RT#37700] + * Document scalar/list context return values from Net::Cmd::message() + * Fix broken URL [Resolves CPAN RT#68749] + * Fix documentation typo in Net::Netrc + * Fix broken POD in Net::POP3 + * Improve Net::SMTP documentation of new(), auth() and message() [Resolves + CPAN RT#36038] + * Add proper skips to skipped tests in ftp.t + * Import hostname.t fix from perl core commit #adeb94125a + * Add time.t, imported from perl core commit #c85707204c + * Add new maintainer information, with updated CPAN and GitHub links + libnet 1.22_01 -- Mon May 31 09:40:25 CDT 2010 * Do not create/pass a remote name if one is not given to put_unique @@ -37,3 +37,4 @@ t/netrc.t t/nntp.t t/require.t t/smtp.t +t/time.t diff --git a/Makefile.PL b/Makefile.PL index dd60ed0..e7f9d05 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -4,7 +4,7 @@ $NAME = 'Net'; $DISTNAME = "libnet"; -$VERSION = "1.22_01"; +$VERSION = "1.22_02"; BEGIN { require 5.002 } @@ -102,7 +102,7 @@ WriteMakefile( ( eval { ExtUtils::MakeMaker->VERSION(6.46) } ? ( META_MERGE => { resources => { ## - repository => 'http://github.com/gbarr/perl-libnet', + repository => 'http://github.com/steve-m-hay/perl-libnet', }, } ) @@ -114,7 +114,7 @@ WriteMakefile( sub MY::postamble { return <<'POSTAMBLE'; -mydist : distmeta distsignature tardist +mydist : distmeta tardist POSTAMBLE @@ -37,7 +37,7 @@ BEGIN { } } -$VERSION = "2.29_1"; +$VERSION = "2.29_2"; @ISA = qw(Exporter); @EXPORT = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING); diff --git a/Net/Config.pm b/Net/Config.pm index bed39cd..24ae2c0 100644 --- a/Net/Config.pm +++ b/Net/Config.pm @@ -13,7 +13,7 @@ use strict; @EXPORT = qw(%NetConfig); @ISA = qw(Net::LocalCfg Exporter); -$VERSION = "1.11"; +$VERSION = "1.11_01"; eval { local $SIG{__DIE__}; require Net::LocalCfg }; @@ -21,7 +21,7 @@ use Net::Cmd; use Net::Config; use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC); -$VERSION = '2.77_2'; +$VERSION = '2.77_3'; @ISA = qw(Exporter Net::Cmd IO::Socket::INET); # Someday I will "use constant", when I am not bothered to much about diff --git a/Net/FTP/dataconn.pm b/Net/FTP/dataconn.pm index 78142af..ef35b63 100644 --- a/Net/FTP/dataconn.pm +++ b/Net/FTP/dataconn.pm @@ -9,7 +9,7 @@ use vars qw(@ISA $timeout $VERSION); use Net::Cmd; use Errno; -$VERSION = '0.11'; +$VERSION = '0.11_02'; @ISA = qw(IO::Socket::INET); diff --git a/Net/Netrc.pm b/Net/Netrc.pm index 02716fe..3414e66 100644 --- a/Net/Netrc.pm +++ b/Net/Netrc.pm @@ -11,7 +11,7 @@ use strict; use FileHandle; use vars qw($VERSION $TESTING); -$VERSION = "2.13"; +$VERSION = "2.13_01"; my %netrc = (); diff --git a/Net/POP3.pm b/Net/POP3.pm index 2a9b532..71b990c 100644 --- a/Net/POP3.pm +++ b/Net/POP3.pm @@ -13,7 +13,7 @@ use Net::Cmd; use Carp; use Net::Config; -$VERSION = "2.29"; +$VERSION = "2.29_01"; @ISA = qw(Net::Cmd IO::Socket::INET); diff --git a/Net/SMTP.pm b/Net/SMTP.pm index 96f0e35..7980334 100644 --- a/Net/SMTP.pm +++ b/Net/SMTP.pm @@ -16,7 +16,7 @@ use IO::Socket; use Net::Cmd; use Net::Config; -$VERSION = "2.31_1"; +$VERSION = "2.31_2"; @ISA = qw(Net::Cmd IO::Socket::INET); diff --git a/Net/libnetFAQ.pod b/Net/libnetFAQ.pod index fdd940d..78efe8c 100644 --- a/Net/libnetFAQ.pod +++ b/Net/libnetFAQ.pod @@ -9,12 +9,14 @@ libnetFAQ - libnet Frequently Asked Questions This document is distributed with the libnet distribution, and is also available on the libnet web page at - http://search.cpan.org/~gbarr/libnet/ + http://search.cpan.org/dist/libnet/ =head2 How to contribute to this document -You may mail corrections, additions, and suggestions to me -gbarr@pobox.com. +You may report corrections, additions, and suggestions on the +CPAN request tracker at + + http://rt.cpan.org/Dist/Display.html?Name=libnet =head1 Author and Copyright Information @@ -22,6 +24,8 @@ Copyright (c) 1997-1998 Graham Barr. All rights reserved. This document is free; you can redistribute it and/or modify it under the terms of the Artistic License. +Currently maintained by Steve Hay <shay@cpan.org>. + =head2 Disclaimer This information is offered in good faith and in the hope that it may @@ -65,12 +69,7 @@ should not be the case with perl version 5.004 or later. The latest libnet release is always on CPAN, you will find it in - http://www.cpan.org/modules/by-module/Net/ - -The latest release and information is also available on the libnet web page -at - - http://search.cpan.org/~gbarr/libnet/ + http://search.cpan.org/dist/libnet/ =head1 Using Net::FTP @@ -22,15 +22,15 @@ AVAILABILITY The latest version of libnet is available from the Comprehensive Perl Archive Network (CPAN). To find a CPAN site near you see: - http://search.cpan.org/~gbarr/libnet/ + http://search.cpan.org/dist/libnet/ -The subversion source repository can be browsed at +The GitHub source repository can be browsed at - http://svn.goingon.net/viewvc/libnet/ + http://github.com/steve-m-hay/perl-libnet -If you have a subversion client, then you can checkout the latest code with +If you have a Git client, then you can checkout the latest code with - svn co http://svn.goingon.net/repos/libnet/trunk libnet + git clone http://github.com/steve-m-hay/perl-libnet.git INSTALLATION @@ -93,7 +93,9 @@ SUPPORT Questions about how to use this library should be directed to the comp.lang.perl.modules USENET Newsgroup. Bug reports and suggestions -for improvements can be sent to me at <gbarr@pobox.com>. +for improvements can be reported on the CPAN request tracker at + + http://rt.cpan.org/Dist/Display.html?Name=libnet Most of the modules in this library have an option to output a debug transcript to STDERR. When reporting bugs/problems please, if possible, @@ -106,4 +108,6 @@ COPYRIGHT This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. +Currently maintained by Steve Hay <shay@cpan.org>. + Share and Enjoy! diff --git a/t/hostname.t b/t/hostname.t index 758d304..4013d74 100644 --- a/t/hostname.t +++ b/t/hostname.t @@ -26,7 +26,10 @@ print "1..5\n"; $domain = domainname(); if(defined $domain && $domain ne "") { - print "ok 1\n"; + print "ok 1 - defined, non-empty domainname\n"; +} +elsif (not defined $domain) { + print "ok 1 # SKIP domain not fully defined\n"; } else { print "not ok 1\n"; diff --git a/t/time.t b/t/time.t new file mode 100644 index 0000000..a8d416e --- /dev/null +++ b/t/time.t @@ -0,0 +1,133 @@ +#!./perl -w + +BEGIN { + if ($ENV{PERL_CORE}) { + chdir 't' if -d 't'; + @INC = '../lib'; + } + if (!eval "require Socket") { + print "1..0 # no Socket\n"; exit 0; + } + if (ord('A') == 193 && !eval "require Convert::EBCDIC") { + print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; + } + $INC{'IO/Socket.pm'} = 1; + $INC{'IO/Select.pm'} = 1; + $INC{'IO/Socket/INET.pm'} = 1; +} + +(my $libnet_t = __FILE__) =~ s/time.t/libnet_t.pl/; +require $libnet_t; + +print "1..12\n"; +# cannot use(), otherwise it will use IO::Socket and IO::Select +eval{ require Net::Time; }; +ok( !$@, 'should be able to require() Net::Time safely' ); +ok( exists $INC{'Net/Time.pm'}, 'should be able to use Net::Time' ); + +# force the socket to fail +make_fail('IO::Socket::INET', 'new'); +my $badsock = Net::Time::_socket('foo', 1, 'bar', 'baz'); +is( $badsock, undef, '_socket() should fail if Socket creation fails' ); + +# if socket is created with protocol UDP (default), it will send a newline +my $sock = Net::Time::_socket('foo', 2, 'bar'); +ok( $sock->isa('IO::Socket::INET'), 'should be an IO::Socket::INET object' ); +is( $sock->{sent}, "\n", 'should send \n with UDP protocol set' ); +is( $sock->{timeout}, 120, 'timeout should default to 120' ); + +# now try it with a custom timeout and a different protocol +$sock = Net::Time::_socket('foo', 3, 'bar', 'tcp', 11); +ok( $sock->isa('IO::Socket::INET'), 'should be an IO::Socket::INET object' ); +is( $sock->{sent}, undef, '_socket() should send nothing unless UDP protocol' ); +is( $sock->{PeerAddr}, 'bar', '_socket() should set PeerAddr in socket' ); +is( $sock->{timeout}, 11, '_socket() should respect custom timeout value' ); + +# inet_daytime +# check for correct args (daytime, 13) +IO::Socket::INET::set_message('z'); +is( Net::Time::inet_daytime('bob'), 'z', 'inet_daytime() should receive data' ); + +# magic numbers defined in Net::Time +my $offset = $^O eq 'MacOS' ? + (4 * 31536000) : (70 * 31536000 + 17 * 86400); + +# check for correct args (time, 13) +# pretend it is only six seconds since the offset, create a fake message +# inet_time +IO::Socket::INET::set_message(pack("N", $offset + 6)); +is( Net::Time::inet_time('foo'), 6, + 'inet_time() should calculate time since offset for time()' ); + + +my %fail; + +sub make_fail { + my ($pack, $func, $num) = @_; + $num = 1 unless defined $num; + + $fail{$pack}{$func} = $num; +} + +package IO::Socket::INET; + +$fail{'IO::Socket::INET'} = { + new => 0, + 'send' => 0, +}; + +sub new { + my $class = shift; + return if $fail{$class}{new} and $fail{$class}{new}--; + bless( { @_ }, $class ); +} + +sub send { + my $self = shift; + my $class = ref($self); + return if $fail{$class}{'send'} and $fail{$class}{'send'}--; + $self->{sent} .= shift; +} + +my $msg; +sub set_message { + if (ref($_[0])) { + $_[0]->{msg} = $_[1]; + } else { + $msg = shift; + } +} + +sub do_recv { + my ($len, $msg) = @_[1,2]; + $_[0] .= substr($msg, 0, $len); +} + +sub recv { + my ($self, $buf, $length, $flags) = @_; + my $message = exists $self->{msg} ? + $self->{msg} : $msg; + + if (defined($message)) { + do_recv($_[1], $length, $message); + } + 1; +} + +package IO::Select; + +sub new { + my $class = shift; + return if defined $fail{$class}{new} and $fail{$class}{new}--; + bless({sock => shift}, $class); +} + +sub can_read { + my ($self, $timeout) = @_; + my $class = ref($self); + return if defined $fail{$class}{can_read} and $fail{class}{can_read}--; + $self->{sock}{timeout} = $timeout; + 1; +} + +1; |