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
This commit is contained in:
Matt Sergeant 2004-09-14 05:48:39 +00:00
parent 069c5a6835
commit 8c37005161

View File

@ -429,11 +429,8 @@ sub data {
my $header = Mail::Header->new(Modify => 0, MailFrom => "COERCE"); my $header = Mail::Header->new(Modify => 0, MailFrom => "COERCE");
my $timeout = $self->config('timeout');
alarm $timeout; while (defined($_ = $self->getline)) {
while (<STDIN>) {
$complete++, last if $_ eq ".\r\n"; $complete++, last if $_ eq ".\r\n";
$i++; $i++;
@ -481,8 +478,6 @@ sub data {
$size += length $_; $size += length $_;
} }
#$self->log(LOGDEBUG, "size is at $size\n") unless ($i % 300); #$self->log(LOGDEBUG, "size is at $size\n") unless ($i % 300);
alarm $timeout;
} }
$self->log(LOGDEBUG, "max_size: $max_size / size: $size"); $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 = <STDIN>; # default implementation
alarm 0;
return $line;
}
sub queue { sub queue {
my ($self, $transaction) = @_; my ($self, $transaction) = @_;