summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Process/Error.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-05-21 08:37:52 +0000
committerfukachan <fukachan>2002-05-21 08:37:52 +0000
commit74cd7050c9deb8f75c6813cd73e6b5a04b57c8cc (patch)
tree0fbe56a3cb394bab5f61d79b4456d3f572b20292 /fml/lib/FML/Process/Error.pm
parente652c047c6f4d0921b7039a9080a2ed9d95b9170 (diff)
downloadfml8-74cd7050c9deb8f75c6813cd73e6b5a04b57c8cc.tar.gz
fml8-74cd7050c9deb8f75c6813cd73e6b5a04b57c8cc.tar.bz2
fml8-74cd7050c9deb8f75c6813cd73e6b5a04b57c8cc.zip
implement a prototype to cache error data
Diffstat (limited to 'fml/lib/FML/Process/Error.pm')
-rw-r--r--fml/lib/FML/Process/Error.pm57
1 files changed, 45 insertions, 12 deletions
diff --git a/fml/lib/FML/Process/Error.pm b/fml/lib/FML/Process/Error.pm
index 3a7f0656..53245728 100644
--- a/fml/lib/FML/Process/Error.pm
+++ b/fml/lib/FML/Process/Error.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2002 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Error.pm,v 1.3 2002/05/19 11:25:24 fukachan Exp $
+# $FML: Error.pm,v 1.4 2002/05/19 11:53:43 fukachan Exp $
#
package FML::Process::Error;
@@ -75,6 +75,7 @@ sub prepare
if ($config->yes('use_error_analyzer')) {
$self->SUPER::prepare($args);
+ $config->{ log_format_type } = 'new_style';
}
else {
exit(0);
@@ -131,9 +132,9 @@ sub run
{
my ($curproc, $args) = @_;
my $config = $curproc->{ config };
- my $found = 0;
- my $pcb = $curproc->{ pcb };
- my $msg = $curproc->{ incoming_message }->{ message };
+ my $found = 0;
+ my $pcb = $curproc->{ pcb };
+ my $msg = $curproc->{ incoming_message }->{ message };
my $eval = $config->get_hook( 'error_run_start_hook' );
if ($eval) { eval qq{ $eval; }; LogWarn($@) if $@; }
@@ -143,14 +144,23 @@ sub run
my $bouncer = new Mail::Bounce;
$bouncer->analyze( $msg );
- # show results
- for my $a ( $bouncer->address_list ) {
+ for my $address ( $bouncer->address_list ) {
$found++;
- my $status = $bouncer->status( $a );
- my $reason = $bouncer->reason( $a );
- Log("bounced: $a");
- Log("bounced: reason=$reason");
+ my $status = $bouncer->status( $address );
+ my $reason = $bouncer->reason( $address );
+ Log("bounced: address=<$address>");
Log("bounced: status=$status");
+ Log("bounced: reason=\"$reason\"");
+ }
+
+ my $obj = $curproc->__open_cache();
+ if (defined $obj) {
+ # show results
+ for my $address ( $bouncer->address_list ) {
+ my $status = $bouncer->status( $address );
+ my $reason = $bouncer->reason( $address );
+ $obj->set($address, $status);
+ }
}
};
LogError($@) if $@;
@@ -209,8 +219,8 @@ sub finish
if ($pcb->get("error", "found")) {
Log("error message found");
- $curproc->inform_reply_messages();
- $curproc->queue_flush();
+ # $curproc->inform_reply_messages();
+ # $curproc->queue_flush();
}
else {
Log("error message not found");
@@ -221,6 +231,29 @@ sub finish
}
+sub __open_cache
+{
+ my ($curproc) = @_;
+ my $config = $curproc->{ config };
+ my $dir = $config->{ error_cache_dir };
+ my $mode = 'temporal';
+ my $days = 14;
+
+ if ($dir) {
+ use File::CacheDir;
+ my $obj = new File::CacheDir {
+ directory => $dir,
+ cache_type => $mode,
+ expires_in => $days,
+ };
+
+ return $obj;
+ }
+
+ return undef;
+}
+
+
=head1 AUTHOR
Ken'ichi Fukamachi