From 8c37005161509eb2dc41faff17613c896e4bc8e4 Mon Sep 17 00:00:00 2001 From: Matt Sergeant Date: Tue, 14 Sep 2004 05:48:39 +0000 Subject: [PATCH] Use a method for getting a line, so we can subclass it. git-svn-id: https://svn.perl.org/qpsmtpd/trunk@316 958fd67b-6ff1-0310-b445-bb7760255be9 --- lib/Qpsmtpd/SMTP.pm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/Qpsmtpd/SMTP.pm b/lib/Qpsmtpd/SMTP.pm index 1f4f2d0..d0d6180 100644 --- a/lib/Qpsmtpd/SMTP.pm +++ b/lib/Qpsmtpd/SMTP.pm @@ -429,11 +429,8 @@ sub data { my $header = Mail::Header->new(Modify => 0, MailFrom => "COERCE"); - my $timeout = $self->config('timeout'); - alarm $timeout; - - while () { + while (defined($_ = $self->getline)) { $complete++, last if $_ eq ".\r\n"; $i++; @@ -481,8 +478,6 @@ sub data { $size += length $_; } #$self->log(LOGDEBUG, "size is at $size\n") unless ($i % 300); - - alarm $timeout; } $self->log(LOGDEBUG, "max_size: $max_size / size: $size"); @@ -528,6 +523,17 @@ sub data { } +sub getline { + my $self = shift; + + my $timeout = $self->config('timeout'); + + alarm $timeout; + my $line = ; # default implementation + alarm 0; + return $line; +} + sub queue { my ($self, $transaction) = @_;