NAME
MIME::ToolUtils - MIME-tools kit configuration and utilities
DESCRIPTION
A catch-all place for miscellaneous global information related to the configuration of the MIME-tools kit.
Since most of the MIME-tools modules "use" it by name, this module is really not subclassable.
PUBLIC INTERFACE
- config [VARIABLE, [VALUE]]
-
Class method. Set/get a configuration variable:
# Get current debugging flag: $current = config MIME::ToolUtils 'DEBUGGING'; # Invert it: config MIME::ToolUtils DEBUGGING => !$current;
Note: as you can see, I like the `arrow' syntax when setting values.
The complete list of configuration variables is listed below. They are all-uppercase, possibly with underscores. To get a list of all valid config variables in your program, and output their current values, you can say:
foreach $var (sort (config MIME::ToolUtils)) { print "MIME config $var = ", (config MIME::ToolUtils $var), "\n"; }
Note that some of these variables may have nice printed representations, while others may not.
Rationale: I wanted access to the configuration to be done via some kind of controllable public interface, in case "setting a config variable" involved making a subroutine call. This approach is an attempt to do so while preventing an explosion of lots of little methods, many of which will do nothing more than set an entry in the internal %CONFIG hash. I suppose a tied hash would have been slicker.
CONFIGURATION VARIABLES
You may set/get all of these via the config
method.
- AUTO_SYNC_HEADERS
-
When printing out a MIME entity, you may find it desirable to always output a Content-Length header (even though this is a non-standard MIME header). If you set this configuration option true (the default is false), the toolkit will attempt to precompute the Content-Length of all singleparts in your message, and set the headers appropriately. Otherwise, it will leave the headers alone.
You should be aware that auto-synching the headers can slow down the printing of messages.
- DEBUGGING
-
Value should be a boolean: true to turn debugging on, false to turn it off.
- EMULATE_TMPFILE
-
Determines how to patch a Perl 5.002 bug in FileHandle::new_tmpfile, and get a FileHandle object which really will be destroyed when it goes out of scope. Possible values are:
- OPENDUP
-
Always emulate FileHandle->new_tmpfile, using an fd-opened duplicate filehandle. Pretty ugly (two additional filehandles sharing the same descriptor are briefly open at one point, though both are closed before the new tmpfile object is returned): however, it's probably quite portable since it (a) doesn't require POSIX, and (b) doesn't make assumptions as to the underlying implementation of FileHandle objects.
- UNLINK
-
Always emulate FileHandle->new_tmpfile, using tmpnam() plus unlink(). Probably only works on Unix-like systems, but is very straightforward. Depends on POSIX::tmpnam() and on the autodelete-on-unlink behavior.
- NO
-
No emulation: always just use FileHandle->new_tmpfile to get tmpfile handles.
- (a subroutine reference)
-
Use the given subroutine, with no arguments, to return a tmpfile.
If any of the named emulation options ends with '!' (e.g., "UNLINK!"), then the package will always emulate that way. Otherwise, it will try to make a reasonable guess as to whether emulation is necessary, based on your version of Perl.
The default setting (if you never invoke this method) is
"OPENDUP"
. - EMULATE_VERSION
-
Emulate the behavior of a previous version of the MIME-tools kit (a.k.a the MIME-parser kit in its version 1.x incarnations). This will not turn off warnings about deprecated usage (that would impede progress), but it will patch things like the
get()
method of MIME::Head:config MIME::ToolUtils EMULATE_VERSION => 1.0;
The value should be '1' or '1.0'. To reliably turn off emulation, set it to undef.
- VERSION
-
Read-only. The version of the toolkit.
config MIME::ToolUtils VERSION => 1.0;
Please notice that as of 3.x, this happens to be the same as the $MIME::ToolUtils::VERSION: however, this was not always the case, and someday may not be the case again.
AUTHOR
Copyright (c) 1996 by Eryq / eryq@rhine.gsfc.nasa.gov
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
VERSION
$Revision: 3.204 $ $Date: 1997/01/22 07:43:19 $
Note: this file is used to set the version of the entire MIME-tools distribution.