diff options
| author | fukachan <fukachan> | 2006-05-13 11:45:40 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2006-05-13 11:45:40 +0000 |
| commit | e910a4f5d2e95a96b3fdac9b089fe32c3ebb0a16 (patch) | |
| tree | b9f853edb485c521d6cbc23058fd15e263c68549 /fml/lib/FML/Process/Utils.pm | |
| parent | 4480917b1d0080b6d32dc6bd502945e596db0ba5 (diff) | |
| download | fml8-e910a4f5d2e95a96b3fdac9b089fe32c3ebb0a16.tar.gz fml8-e910a4f5d2e95a96b3fdac9b089fe32c3ebb0a16.tar.bz2 fml8-e910a4f5d2e95a96b3fdac9b089fe32c3ebb0a16.zip | |
enable body based loop check
Diffstat (limited to 'fml/lib/FML/Process/Utils.pm')
| -rw-r--r-- | fml/lib/FML/Process/Utils.pm | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/fml/lib/FML/Process/Utils.pm b/fml/lib/FML/Process/Utils.pm index 898a8382..f74c6f90 100644 --- a/fml/lib/FML/Process/Utils.pm +++ b/fml/lib/FML/Process/Utils.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: Utils.pm,v 1.148 2006/02/15 13:44:04 fukachan Exp $ +# $FML: Utils.pm,v 1.149 2006/04/22 08:29:23 fukachan Exp $ # package FML::Process::Utils; @@ -329,6 +329,64 @@ sub incoming_message_remove_queue } +=head2 incoming_message_print_body_as_file() + +dupliate the body part into a temporary file. +return a newly created temporary file path. + +=cut + + +# Descriptions: dupliate the body part into a temporary file. +# Arguments: OBJ($curproc) OBJ($queue) +# Side Effects: create a temporary file. +# Return Value: STR +sub incoming_message_print_body_as_file +{ + my ($curproc, $queue) = @_; + my $cache_file = $curproc->incoming_message_get_cache_file_path(); + my $tmp_file = $curproc->tmp_file_path(); + + if (-f $cache_file) { + my $rh = new FileHandle $cache_file; + my $wh = new FileHandle "> $tmp_file"; + if (defined $rh && defined $wh) { + my $found = 0; + my $buf; + LINE: + while ($buf = <$rh>) { + unless ($found) { + if ($buf =~ /^$/o) { + $found = 1; + } + next LINE; + } + print $wh $buf; + } + $wh->close(); + $rh->close(); + + return $tmp_file; + } + else { + my $myname = "incoming_message_dup_body"; + unless (defined $rh) { + $curproc->logerror("$myname: cannot open $cache_file"); + } + unless (defined $wh) { + $curproc->logerror("$myname: cannot open $tmp_file"); + } + + return undef; + } + } + else { + $curproc->logerror("incoming_message_dup_body: no cache"); + return undef; + } +} + + =head1 access METHODS to handle article available only in C<libexec/distribute> process. |
