Using MH from Other Languages
[table of contents] [index]
Programs that use MH commands don't have to be interpreted by the Bourne
shell, of course.
An MH command may be run by any language that will start a UNIX process and can:
In a lot of cases, the program will do its own processing of
text output by MH commands.
For instance, Perl is good at parsing the headers of email messages.
So, instead of using MH format strings, a Perl script might use
show -noshowproc or mhpath to read a message header into
an array -- then use Perl regular expression operators to get the
information you need.
Pass command-line arguments to the process.
Pass environment variables to it.
Pass text to the standard input of the process and read its standard output.
When you're trying to decide whether to use MH features or the features
of your language, how do you choose?
Get familiar with all the features of MH.
Compare them to the features in the languages you might choose as a
"wrapper" around MH commands.
MH was designed for use in programming, so there are lots of "hooks" for
Knowing about these hooks can save you a lot of time "re-inventing the
wheel" in another language.
Think about efficiency.
On many systems, especially busy ones, getting a UNIX process started
takes a lot of time.
Can you design an
MH command version
that does what you
need -- without starting a "wrapper" process around the MH command?
How much clock time does your "wrapper" need to start running
before it executes the MH command?
On the other hand, can your interpreter do the work of several MH commands
in its own single process, thereby saving execution time?
[Table of Contents] [Index]
[Previous: Writing Shell Scripts for MH]
[Next: How Does Your System Execute Files?]
Last change $Date: 1996/06/06 15:15:14 $
This file is from the third edition of the book MH & xmh: Email
for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek.
Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc.
This file is freely-available; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation. For more information, see
the file copying.htm.
Suggestions are welcome:
Jerry Peek <firstname.lastname@example.org>
Questions or problems regarding this web site should be directed to Steve Gielda.
Copyright © 1999 www.cotse.com. All rights reserved.
Last modified: Friday April 02, 1999.