[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] running 2 Perl processes at once



At 00.03 -0500 1999.02.02, Paul Gutches wrote:
>I'm running Matt Wright's WWWBoard on a website and would like to add a
>private feature that notifies the original poster of a response based on
>a restricted followup user name.  I can see all the variables I have to
>play with... but I think what's giving me trouble is determining how to
>accomplish both the wwwboard process and the mail process in parallel.
>I've tried working with fork( )... and waitpid( ) ...but it ain't
>happening.

Of course not.  :)  Those are clearly documented as unimplemented.  See the
MacPerl book and macperlport (on my web site and on CPAN).  And running
"fork" gives you:

# The Unsupported function fork function is unimplemented.


And trying open(FORK, "|-") is similarly bad:

# Implicit fork() on a Mac? No forking chance.


>If someone could let me know what I have to look into to accomplish
>this... or what some of the issues are I should be aware of I'd
>appreciate it.

First, why do you need a separate process?  Why not handle it in one?
Maybe you've already done this, but you should first definitively rule out
the possibility before moving on.

On this, I would look into using a mail server like EIMS.  I am not sure if
it does, but some mail servers have drop folders.  You just save the mail,
already formatted with headers, etc. (which is easily done with some of the
Mail:: modules), and then save as a separate text file to a folder.  The
mail server would pick it up and take care of the mailing.  This would have
significantly less overhead than worrying about other processes, and it
would be more reliable than sending the mail directly.

If you do want to send the mail directly with MacPerl, and want a separate
process, you can do it in one of two ways.  First of all you would need a
separate MacPerl application, either a runtime or a full copy.  Then you
could have it running all the time, periodically checking a folder like a
real mail server could do, or have it accept Apple Events (using the
Mac::AppleEvents module and the %AppleEvent hash) from your other MacPerl
application.

On the latter, see "Chris' AppleEvent Tutorial" (in your Help menu, or on
my site), and the example files in your ext folder.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch