about summary refs log tree commit
path: root/lib/Net/Cmd.pm
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2016-07-28 14:22:16 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2016-07-28 14:22:16 +0100
commit95330178b26b96232dddb188f82ad33da0d0b293 (patch)
tree0e7337853e02f5fb59893db0e8322b9a51d7940e /lib/Net/Cmd.pm
parent41e46adcef382389085fdb979c5288b4ed2cf77c (diff)
downloadperl-libnet-95330178b26b96232dddb188f82ad33da0d0b293.tar.gz
Remove the default Net::Cmd::timeout()
This accidentally overrode the timeout() in Net::FTP's $IOCLASS. Instead,
we now document that timeout() needs to be provided by the Net::Cmd
sub-class (normally by inheriting from IO::Socket::INET or similar (which
in turn inherit from IO::Socket, which provides timeout()), which most
users seem to do anyway).

Similarly, document that close() most also be provided (normally by
inheriting from IO::Handle, which IO::Socket::INET or similar also do, via
IO::Socket).

This fixes CPAN RT#116345. Thanks to ppisar@redhat.com for the analysis.
Diffstat (limited to 'lib/Net/Cmd.pm')
-rw-r--r--lib/Net/Cmd.pm17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/Net/Cmd.pm b/lib/Net/Cmd.pm
index e739c89..38054c4 100644
--- a/lib/Net/Cmd.pm
+++ b/lib/Net/Cmd.pm
@@ -190,8 +190,6 @@ sub set_status {
   1;
 }
 
-sub timeout { 0 }
-
 sub _syswrite_with_timeout {
   my $cmd = shift;
   my $line = shift;
@@ -656,10 +654,15 @@ Net::Cmd - Network Command class (as used by FTP, SMTP etc)
 
 =head1 DESCRIPTION
 
-C<Net::Cmd> is a collection of methods that can be inherited by a sub class
-of C<IO::Handle>. These methods implement the functionality required for a
+C<Net::Cmd> is a collection of methods that can be inherited by a sub-class
+of C<IO::Socket::INET>. These methods implement the functionality required for a
 command based protocol, for example FTP and SMTP.
 
+If your sub-class does not also derive from C<IO::Socket::INET> or similar (e.g.
+C<IO::Socket::IP>, C<IO::Socket::INET6> or C<IO::Socket::SSL>) then you must
+provide the following methods by other means yourself: C<close()> and
+C<timeout()>.
+
 =head1 USER METHODS
 
 These methods provide a user interface to the C<Net::Cmd> object.
@@ -750,12 +753,6 @@ command server.
 
 Returns undef upon failure.
 
-=item timeout ()
-
-Returns the timeout value for this class, in seconds. The timeout provided
-by the default implementation is 0; subclasses may override this if they
-choose.
-
 =item unsupported ()
 
 Sets the status code to 580 and the response text to 'Unsupported command'.