mhonarc-users

Re: Using process_input

2000-11-26 04:39:27
On November 25, 2000 at 17:43, Aaron Johnson wrote:

(Mr. Hood, I think I sent this to the mailing list as well, but the
address for the mailing list didn't match what was on the site, so sent
to you just in case. Sorry for any duplicates).

You have to be subscribed to the list to send mail to it.  Mail
sent to mhonarc(_at_)pobox(_dot_)com just comes to me.  I'm cc'ing the list
on my response since your questions may be of interest to others
(and your original intent was to send to the list).

I have been using MHonArc to process files inside of our applcation for
a little over a year now, but I resently wanted to change how the
processing was done and started running into some areas that confused
me.

Presently I use this:
        my $message = qx!/usr/bin/mhonarc -single -outdir=$out_dir
$filename!;
        return ($message);

This is working fine, but now I need to have variables from my main
scripts available inside of MHonArc so I can process the files one time
only.

To be careful, make sure that your scripts are contained in their
own package namespace.  The main mhonarc code is qualified in the
"mhonarc" package.  The various mimefilters are qualified in their
own packages.

After looking through the archives I found information about the
process_input function and tried to implement using it.  It appears that

it defaults the output to STDOUT (direct to browser).

Correct, which is important to you since you are using SINGLE.  You
can dup STDOUT to something else before calling process_input() to
have output go somewhere else.

Here is what I know so far:
The mhexternal.pl file is where I can handle the custom processing of
the each file as it is created.

Sort of.  The process of message content is handled by the MIMEFILTERS
resource.  See the documentation on MIMEFILTERS for more information
and to see the list of default filters used.

I could pass more options, but I would rather not hack the mhonarc code
to much if possible.
The variables I need are available when using the process_input method,
but the output is sent deirectly to the browser instead of being
controled by the Apache::ASP module.

Use file duping.

Here is what I want to do:
I read the messages in from their POP3 account
Parse the message with mhonarc
During the parsing -
    save all attachments to the users online folders.
    Change the link at the bottom of the email to retrieve the file from

the online folder

So in a nutshell:
my ($message) = mhonarc::process_input('-single',"$filename");
isn't putting the output into the variable.

process_input returns the CPU time taken to process input.  A trick
is to tie a string to a filehandle and dup the filehandle to STDOUT.
I'm unsure if anyone has writting a module that ties a string to
a filehandle.  If not, you can implement your own as documented in
the perltie manpage.

--ewh

<Prev in Thread] Current Thread [Next in Thread>