about summary refs log tree commit
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2016-07-07 08:39:04 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2016-07-07 08:39:04 +0100
commit91e593b615334fa76ef0454c4e601b98b6663841 (patch)
tree5c8dd2ba9a6aa1cd19a8c9cb0694fb86bfaa574d
parent2e2c495046bf48fd154f6ea6f59236817963a003 (diff)
downloadperl-libnet-91e593b615334fa76ef0454c4e601b98b6663841.tar.gz
Provide (and document) a default Net::Cmd::timeout()
Previuosly, subclasses were required to provide a timeout() function, but
this was not documented anywhere!

Fixes CPAN RT#110978.
-rw-r--r--Changes2
-rw-r--r--lib/Net/Cmd.pm8
-rw-r--r--t/datasend.t2
3 files changed, 9 insertions, 3 deletions
diff --git a/Changes b/Changes
index 3992e00..5457727 100644
--- a/Changes
+++ b/Changes
@@ -2,7 +2,7 @@ Revision history for Perl distribution libnet
 
 3.09 Development
 
-    - TODO
+    - Provide (and document) a default Net::Cmd::timeout().  [CPAN RT#110978]
 
 3.08 2016-01-05
 
diff --git a/lib/Net/Cmd.pm b/lib/Net/Cmd.pm
index 1c312ca..3f102b9 100644
--- a/lib/Net/Cmd.pm
+++ b/lib/Net/Cmd.pm
@@ -190,6 +190,8 @@ sub set_status {
   1;
 }
 
+sub timeout { 0 }
+
 sub _syswrite_with_timeout {
   my $cmd = shift;
   my $line = shift;
@@ -748,6 +750,12 @@ 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'.
diff --git a/t/datasend.t b/t/datasend.t
index 0aea9d4..05903fb 100644
--- a/t/datasend.t
+++ b/t/datasend.t
@@ -21,8 +21,6 @@ BEGIN {
   use Net::Cmd;
   our @ISA = qw(Net::Cmd IO::File);
 
-  sub timeout { 0 }
-
   sub new {
     my $fh = shift->new_tmpfile;
     binmode($fh);