From 91e593b615334fa76ef0454c4e601b98b6663841 Mon Sep 17 00:00:00 2001 From: Steve Hay Date: Thu, 7 Jul 2016 08:39:04 +0100 Subject: 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. --- Changes | 2 +- lib/Net/Cmd.pm | 8 ++++++++ t/datasend.t | 2 -- 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); -- cgit v1.2.3-24-ge0c7