summaryrefslogtreecommitdiff
path: root/fml/lib/Mail
diff options
context:
space:
mode:
authorfukachan <fukachan>2004-06-27 06:02:59 +0000
committerfukachan <fukachan>2004-06-27 06:02:59 +0000
commitbbbe034b66124f01c94a0d8b36aa9ab3ee7d8849 (patch)
tree80d8160cb033d59818529c44044a18a73906c103 /fml/lib/Mail
parent6ee839b2e6c6b376e86ad0bbf2e782bf55f80f7e (diff)
downloadfml8-bbbe034b66124f01c94a0d8b36aa9ab3ee7d8849.tar.gz
fml8-bbbe034b66124f01c94a0d8b36aa9ab3ee7d8849.tar.bz2
fml8-bbbe034b66124f01c94a0d8b36aa9ab3ee7d8849.zip
validate if message object supports write_count() method.
Diffstat (limited to 'fml/lib/Mail')
-rw-r--r--fml/lib/Mail/Delivery/Queue.pm37
1 files changed, 20 insertions, 17 deletions
diff --git a/fml/lib/Mail/Delivery/Queue.pm b/fml/lib/Mail/Delivery/Queue.pm
index 174353f8..baa42450 100644
--- a/fml/lib/Mail/Delivery/Queue.pm
+++ b/fml/lib/Mail/Delivery/Queue.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Queue.pm,v 1.37 2004/05/25 03:43:02 fukachan Exp $
+# $FML: Queue.pm,v 1.38 2004/06/27 02:39:31 fukachan Exp $
#
package Mail::Delivery::Queue;
@@ -380,23 +380,25 @@ sub in
}
$fh->close;
- my $write_count = $self->{ _write_count } = $msg->write_count();
-
- use File::stat;
- my $try_count = 3;
- my $ok = 0;
- TRY:
- while ($try_count-- > 0) {
- my $st = stat($qf);
- if ($st->size == $write_count) {
- $ok = 1;
- last TRY;
+ if ($msg->can('write_count')) {
+ my $write_count = $self->{ _write_count } = $msg->write_count();
+
+ use File::stat;
+ my $try_count = 3;
+ my $ok = 0;
+ TRY:
+ while ($try_count-- > 0) {
+ my $st = stat($qf);
+ if ($st->size == $write_count) {
+ $ok = 1;
+ last TRY;
+ }
+ sleep 1;
}
- sleep 1;
- }
- unless ($ok) {
- $self->error_set("write error: size mismatch");
+ unless ($ok) {
+ $self->error_set("write error: size mismatch");
+ }
}
}
@@ -412,7 +414,8 @@ sub in
sub write_count
{
my ($self) = @_;
- return $self->{ _write_count };
+
+ return( $self->{ _write_count } || 0 );
}