home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-perl-addon-1.4.9-installer.exe / Tools.pm < prev    next >
Encoding:
Perl POD Document  |  2002-06-14  |  62.0 KB  |  2,008 lines

  1. package MIME::Tools;
  2.  
  3. #------------------------------
  4. # Because the POD documenation is pretty extensive, it follows
  5. # the __END__ statement below...
  6. #------------------------------
  7.  
  8. use strict;
  9. use vars (qw(@ISA %CONFIG @EXPORT_OK %EXPORT_TAGS $VERSION $ME
  10.          $M_DEBUG $M_WARNING $M_ERROR
  11.          $Tmpopen ));
  12.  
  13. require Exporter;
  14. use FileHandle;
  15. use Carp;
  16. use Benchmark;
  17.  
  18. $ME = "MIME-tools";
  19.  
  20. @ISA = qw(Exporter);
  21.  
  22. # Exporting (importing should only be done by modules in this toolkit!):
  23. %EXPORT_TAGS = (
  24.     'config'  => [qw(%CONFIG)],
  25.     'msgs'    => [qw(usage debug whine error)],
  26.     'msgtypes'=> [qw($M_DEBUG $M_WARNING $M_ERROR)],        
  27.     'utils'   => [qw(benchmark catfile shellquote textual_type tmpopen )],
  28.     );
  29. Exporter::export_ok_tags('config', 'msgs', 'msgtypes', 'utils');
  30.  
  31. # The TOOLKIT version, both in 1.23 style *and* usable by MakeMaker:
  32. $VERSION = substr q$Revision: 5.411 $, 10;
  33.  
  34. # Configuration (do NOT alter this directly)...
  35. # All legal CONFIG vars *must* be in here, even if only to be set to undef:
  36. %CONFIG =
  37.     (
  38.      DEBUGGING       => 0,
  39.      QUIET           => 1,
  40.      );
  41.  
  42. # Message-logging constants:
  43. $M_DEBUG   = 'debug';
  44. $M_WARNING = 'warning';
  45. $M_ERROR   = 'error';
  46.  
  47.  
  48.  
  49. #------------------------------
  50. #
  51. # CONFIGURATION... (see below)
  52. #
  53. #------------------------------
  54.  
  55. sub config {
  56.     my $class = shift;
  57.     usage("config() is obsolete");
  58.  
  59.     # No args? Just return list:
  60.     @_ or return keys %CONFIG;
  61.     my $method = lc(shift);
  62.     return $class->$method(@_);
  63. }
  64.  
  65. sub debugging {
  66.     my ($class, $value) = @_;
  67.     $CONFIG{'DEBUGGING'} = $value   if (@_ > 1);
  68.     $CONFIG{'DEBUGGING'};
  69. }
  70.  
  71. sub quiet {
  72.     my ($class, $value) = @_;
  73.     $CONFIG{'QUIET'} = $value   if (@_ > 1);
  74.     $CONFIG{'QUIET'};
  75. }
  76.  
  77. sub version {
  78.     my ($class, $value) = @_;
  79.     $VERSION;
  80. }
  81.  
  82.  
  83.  
  84. #------------------------------
  85. #
  86. # MESSAGES...
  87. #
  88. #------------------------------
  89.  
  90. #------------------------------
  91. #
  92. # debug MESSAGE...
  93. #
  94. # Function, private.
  95. # Output a debug message.
  96. #
  97. sub debug {
  98.     print STDERR "$ME: $M_DEBUG: ", @_, "\n"      if $CONFIG{DEBUGGING};
  99. }
  100.  
  101. #------------------------------
  102. #
  103. # whine MESSAGE...
  104. #
  105. # Function, private.
  106. # Something doesn't look right: issue a warning.
  107. # Only output if $^W (-w) is true, and we're not being QUIET.
  108. #
  109. sub whine {
  110.     my $msg = "$ME: $M_WARNING: ".join('', @_)."\n";
  111.     warn $msg if ($^W && !$CONFIG{QUIET});
  112.     return (wantarray ? () : undef);
  113. }
  114.  
  115. #------------------------------
  116. #
  117. # error MESSAGE...
  118. #
  119. # Function, private.
  120. # Something failed, but not so badly that we want to throw an
  121. # exception.  Just report our general unhappiness.
  122. # Only output if $^W (-w) is true, and we're not being QUIET.
  123. #
  124. sub error {
  125.     my $msg = "$ME: $M_ERROR: ".join('', @_)."\n";
  126.     warn $msg if ($^W && !$CONFIG{QUIET});
  127.     return (wantarray ? () : undef);
  128. }
  129.  
  130. #------------------------------
  131. #
  132. # usage MESSAGE...
  133. #
  134. # Register unhappiness about usage.
  135. #
  136. sub usage {
  137.     my ( $p,  $f,  $l,  $s) = caller(1);
  138.     my ($cp, $cf, $cl, $cs) = caller(2);
  139.     my $msg = join('', (($s =~ /::/) ? "$s() " : "${p}::$s() "), @_, "\n");
  140.     my $loc = ($cf ? "\tin code called from $cf l.$cl" : '');
  141.  
  142.     warn "$msg$loc\n" if ($^W && !$CONFIG{QUIET});
  143.     return (wantarray ? () : undef);
  144. }
  145.  
  146.  
  147.  
  148. #------------------------------
  149. #
  150. # UTILS...
  151. #
  152. #------------------------------
  153.  
  154. #------------------------------
  155. #
  156. # benchmark CODE
  157. #
  158. # Private benchmarking utility.
  159. #
  160. sub benchmark(&) {
  161.     my ($code) = @_;
  162.     if (1) {
  163.     my $t0 = new Benchmark;
  164.     &$code;
  165.     my $t1 = new Benchmark;
  166.     return timestr(timediff($t1, $t0));
  167.     }
  168.     else {
  169.     &$code;
  170.     return "";
  171.     }
  172. }
  173.  
  174. #------------------------------
  175. #
  176. # catfile DIR, FILE
  177. #
  178. # Directory/file concatenation.
  179. #
  180. sub catfile {
  181.     my ($parent, $child) = @_;
  182.     if ($^O eq 'Mac') {
  183.     $parent =~ s{:\Z}{};
  184.     return "$parent:$child";
  185.     }
  186.     else {
  187.     $parent =~ s{/\Z}{};
  188.     return "$parent/$child";
  189.     }
  190. }
  191.  
  192. #------------------------------
  193. #
  194. # shellquote STRING
  195. #
  196. # Private utility: make string safe for shell.
  197. #
  198. sub shellquote {
  199.     my $str = shift;
  200.     $str =~ s/\$/\\\$/g;
  201.     $str =~ s/\`/\\`/g;
  202.     $str =~ s/\"/\\"/g;
  203.     return "\"$str\"";        # wrap in double-quotes
  204. }
  205.  
  206. #------------------------------
  207. #
  208. # textual_type MIMETYPE
  209. #
  210. # Function.  Does the given MIME type indicate a textlike document?
  211. #
  212. sub textual_type {
  213.     ($_[0] =~ m{^(text|message)(/|\Z)}i);
  214. }
  215.  
  216. #------------------------------
  217. #
  218. # tmpopen
  219. #
  220. #
  221. sub tmpopen {
  222.     &$Tmpopen();
  223. }
  224.  
  225. $Tmpopen = sub { IO::File->new_tmpfile; };
  226.  
  227.  
  228.  
  229.  
  230.  
  231. #------------------------------
  232. 1;
  233. package MIME::ToolUtils;
  234. @MIME::ToolUtils::ISA = qw(MIME::Tools);
  235. __END__
  236.  
  237.  
  238. =head1 NAME
  239.  
  240. MIME-tools - modules for parsing (and creating!) MIME entities
  241.  
  242.  
  243. =head1 SYNOPSIS
  244.  
  245. Here's some pretty basic code for B<parsing a MIME message,> and outputting
  246. its decoded components to a given directory:
  247.  
  248.     use MIME::Parser;
  249.  
  250.     ### Create parser, and set some parsing options:
  251.     my $parser = new MIME::Parser;
  252.     $parser->output_under("$ENV{HOME}/mimemail");
  253.  
  254.     ### Parse input:
  255.     $entity = $parser->parse(\*STDIN) or die "parse failed\n";
  256.  
  257.     ### Take a look at the top-level entity (and any parts it has):
  258.     $entity->dump_skeleton;
  259.  
  260.  
  261. Here's some code which B<composes and sends a MIME message> containing
  262. three parts: a text file, an attached GIF, and some more text:
  263.  
  264.     use MIME::Entity;
  265.  
  266.     ### Create the top-level, and set up the mail headers:
  267.     $top = MIME::Entity->build(Type    =>"multipart/mixed",
  268.                                From    => "me\@myhost.com",
  269.                            To      => "you\@yourhost.com",
  270.                                Subject => "Hello, nurse!");
  271.  
  272.     ### Part #1: a simple text document:
  273.     $top->attach(Path=>"./testin/short.txt");
  274.  
  275.     ### Part #2: a GIF file:
  276.     $top->attach(Path        => "./docs/mime-sm.gif",
  277.                  Type        => "image/gif",
  278.                  Encoding    => "base64");
  279.  
  280.     ### Part #3: some literal text:
  281.     $top->attach(Data=>$message);
  282.  
  283.     ### Send it:
  284.     open MAIL, "| /usr/lib/sendmail -t -oi -oem" or die "open: $!";
  285.     $top->print(\*MAIL);
  286.     close MAIL;
  287.  
  288.  
  289. For more examples, look at the scripts in the B<examples> directory
  290. of the MIME-tools distribution.
  291.  
  292.  
  293.  
  294. =head1 DESCRIPTION
  295.  
  296. MIME-tools is a collection of Perl5 MIME:: modules for parsing, decoding,
  297. I<and generating> single- or multipart (even nested multipart) MIME
  298. messages.  (Yes, kids, that means you can send messages with attached
  299. GIF files).
  300.  
  301.  
  302. =head1 REQUIREMENTS
  303.  
  304. You will need the following installed on your system:
  305.  
  306.     File::Path
  307.     File::Spec
  308.     IPC::Open2              (optional)
  309.     IO::Scalar, ...         from the IO-stringy distribution
  310.     MIME::Base64
  311.     MIME::QuotedPrint
  312.     Net::SMTP
  313.     Mail::Internet, ...     from the MailTools distribution.
  314.  
  315. See the Makefile.PL in your distribution for the most-comprehensive
  316. list of prerequisite modules and their version numbers.
  317.  
  318.  
  319. =head1 A QUICK TOUR
  320.  
  321. =head2 Overview of the classes
  322.  
  323. Here are the classes you'll generally be dealing with directly:
  324.  
  325.  
  326.     (START HERE)            results() .-----------------.
  327.           \                 .-------->| MIME::          |
  328.            .-----------.   /          | Parser::Results |
  329.            | MIME::    |--'           `-----------------'
  330.            | Parser    |--.           .-----------------.
  331.            `-----------'   \ filer()  | MIME::          |
  332.               | parse()     `-------->| Parser::Filer   |
  333.               | gives you             `-----------------'
  334.               | a...                                  | output_path()
  335.               |                                   | determines
  336.               |                          | path() of...
  337.               |    head()       .--------.          |
  338.               |    returns...   | MIME:: | get()      |
  339.               V       .-------->| Head   | etc...     |
  340.            .--------./          `--------'            |
  341.      .---> | MIME:: |                       |
  342.      `-----| Entity |           .--------.            |
  343.    parts() `--------'\          | MIME:: |           /
  344.    returns            `-------->| Body   |<---------'
  345.    sub-entities    bodyhandle() `--------'
  346.    (if any)        returns...       | open()
  347.                                     | returns...
  348.                                     |
  349.                                     V
  350.                                 .--------. read()
  351.                                 | IO::   | getline()
  352.                                 | Handle | print()
  353.                                 `--------' etc...
  354.  
  355.  
  356. To illustrate, parsing works this way:
  357.  
  358. =over 4
  359.  
  360. =item *
  361.  
  362. B<The "parser" parses the MIME stream.>
  363. A parser is an instance of C<MIME::Parser>.
  364. You hand it an input stream (like a filehandle) to parse a message from:
  365. if the parse is successful, the result is an "entity".
  366.  
  367. =item *
  368.  
  369. B<A parsed message is represented by an "entity".>
  370. An entity is an instance of C<MIME::Entity> (a subclass of C<Mail::Internet>).
  371. If the message had "parts" (e.g., attachments), then those parts
  372. are "entities" as well, contained inside the top-level entity.
  373. Each entity has a "head" and a "body".
  374.  
  375. =item *
  376.  
  377. B<The entity's "head" contains information about the message.>
  378. A "head" is an instance of C<MIME::Head> (a subclass of C<Mail::Header>).
  379. It contains information from the message header: content type,
  380. sender, subject line, etc.
  381.  
  382. =item *
  383.  
  384. B<The entity's "body" knows where the message data is.>
  385. You can ask to "open" this data source for I<reading> or I<writing>,
  386. and you will get back an "I/O handle".
  387.  
  388. =item *
  389.  
  390. B<You can open() a "body" and get an "I/O handle" to read/write message data.>
  391. This handle is an object that is basically like an IO::Handle or
  392. a FileHandle... it can be any class, so long as it supports a small,
  393. standard set of methods for reading from or writing to the underlying
  394. data source.
  395.  
  396. =back
  397.  
  398. A typical multipart message containing two parts -- a textual greeting
  399. and an "attached" GIF file -- would be a tree of MIME::Entity objects,
  400. each of which would have its own MIME::Head.  Like this:
  401.  
  402.     .--------.
  403.     | MIME:: | Content-type: multipart/mixed
  404.     | Entity | Subject: Happy Samhaine!
  405.     `--------'
  406.          |
  407.          `----.
  408.         parts |
  409.               |   .--------.
  410.               |---| MIME:: | Content-type: text/plain; charset=us-ascii
  411.               |   | Entity | Content-transfer-encoding: 7bit
  412.               |   `--------'
  413.               |   .--------.
  414.               |---| MIME:: | Content-type: image/gif
  415.                   | Entity | Content-transfer-encoding: base64
  416.                   `--------' Content-disposition: inline;
  417.                                filename="hs.gif"
  418.  
  419.  
  420.  
  421. =head2 Parsing messages
  422.  
  423. You usually start by creating an instance of B<MIME::Parser>
  424. and setting up certain parsing parameters: what directory to save
  425. extracted files to, how to name the files, etc.
  426.  
  427. You then give that instance a readable filehandle on which waits a
  428. MIME message.  If all goes well, you will get back a B<MIME::Entity>
  429. object (a subclass of B<Mail::Internet>), which consists of...
  430.  
  431. =over 4
  432.  
  433. =item *
  434.  
  435. A B<MIME::Head> (a subclass of B<Mail::Header>) which holds the MIME
  436. header data.
  437.  
  438. =item *
  439.  
  440. A B<MIME::Body>, which is a object that knows where the body data is.
  441. You ask this object to "open" itself for reading, and it
  442. will hand you back an "I/O handle" for reading the data: this is
  443. a FileHandle-like object, and could be of any class, so long as it
  444. conforms to a subset of the B<IO::Handle> interface.
  445.  
  446. =back
  447.  
  448. If the original message was a multipart document, the MIME::Entity
  449. object will have a non-empty list of "parts", each of which is in
  450. turn a MIME::Entity (which might also be a multipart entity, etc,
  451. etc...).
  452.  
  453. Internally, the parser (in MIME::Parser) asks for instances
  454. of B<MIME::Decoder> whenever it needs to decode an encoded file.
  455. MIME::Decoder has a mapping from supported encodings (e.g., 'base64')
  456. to classes whose instances can decode them.  You can add to this mapping
  457. to try out new/experiment encodings.  You can also use
  458. MIME::Decoder by itself.
  459.  
  460.  
  461. =head2 Composing messages
  462.  
  463. All message composition is done via the B<MIME::Entity> class.
  464. For single-part messages, you can use the B<MIME::Entity/build>
  465. constructor to create MIME entities very easily.
  466.  
  467. For multipart messages, you can start by creating a top-level
  468. C<multipart> entity with B<MIME::Entity::build()>, and then use
  469. the similar B<MIME::Entity::attach()> method to attach parts to
  470. that message.  I<Please note:> what most people think of as
  471. "a text message with an attached GIF file" is I<really> a multipart
  472. message with 2 parts: the first being the text message, and the
  473. second being the GIF file.
  474.  
  475. When building MIME a entity, you'll have to provide two very important
  476. pieces of information: the I<content type> and the
  477. I<content transfer encoding>.  The type is usually easy, as it is directly
  478. determined by the file format; e.g., an HTML file is C<text/html>.
  479. The encoding, however, is trickier... for example, some HTML files are
  480. C<7bit>-compliant, but others might have very long lines and would need to be
  481. sent C<quoted-printable> for reliability.
  482.  
  483. See the section on encoding/decoding for more details, as well as
  484. L<"A MIME PRIMER">.
  485.  
  486.  
  487. =head2 Sending email
  488.  
  489. Since MIME::Entity inherits directly from Mail::Internet,
  490. you can use the normal Mail::Internet mechanisms to send
  491. email.  For example,
  492.  
  493.     $entity->smtpsend;
  494.  
  495.  
  496.  
  497. =head2 Encoding/decoding support
  498.  
  499. The B<MIME::Decoder> class can be used to I<encode> as well; this is done
  500. when printing MIME entities.  All the standard encodings are supported
  501. (see L<"A MIME PRIMER"> for details):
  502.  
  503.     Encoding:        | Normally used when message contents are:
  504.     -------------------------------------------------------------------
  505.     7bit             | 7-bit data with under 1000 chars/line, or multipart.
  506.     8bit             | 8-bit data with under 1000 chars/line.
  507.     binary           | 8-bit data with some long lines (or no line breaks).
  508.     quoted-printable | Text files with some 8-bit chars (e.g., Latin-1 text).
  509.     base64           | Binary files.
  510.  
  511. Which encoding you choose for a given document depends largely on
  512. (1) what you know about the document's contents (text vs binary), and
  513. (2) whether you need the resulting message to have a reliable encoding
  514. for 7-bit Internet email transport.
  515.  
  516. In general, only C<quoted-printable> and C<base64> guarantee reliable
  517. transport of all data; the other three "no-encoding" encodings simply
  518. pass the data through, and are only reliable if that data is 7bit ASCII
  519. with under 1000 characters per line, and has no conflicts with the
  520. multipart boundaries.
  521.  
  522. I've considered making it so that the content-type and encoding
  523. can be automatically inferred from the file's path, but that seems
  524. to be asking for trouble... or at least, for Mail::Cap...
  525.  
  526.  
  527.  
  528. =head2 Message-logging
  529.  
  530. MIME-tools is a large and complex toolkit which tries to deal with
  531. a wide variety of external input.  It's sometimes helpful to see
  532. what's really going on behind the scenes.
  533. There are several kinds of messages logged by the toolkit itself:
  534.  
  535. =over 4
  536.  
  537. =item Debug messages
  538.  
  539. These are printed directly to the STDERR, with a prefix of
  540. C<"MIME-tools: debug">.
  541.  
  542. Debug message are only logged if you have turned
  543. L</debugging> on in the MIME::Tools configuration.
  544.  
  545.  
  546. =item Warning messages
  547.  
  548. These are logged by the standard Perl warn() mechanism
  549. to indicate an unusual situation.
  550. They all have a prefix of C<"MIME-tools: warning">.
  551.  
  552. Warning messages are only logged if C<$^W> is set true
  553. and MIME::Tools is not configured to be L</quiet>.
  554.  
  555.  
  556. =item Error messages
  557.  
  558. These are logged by the standard Perl warn() mechanism
  559. to indicate that something actually failed.
  560. They all have a prefix of C<"MIME-tools: error">.
  561.  
  562. Error messages are only logged if C<$^W> is set true
  563. and MIME::Tools is not configured to be L</quiet>.
  564.  
  565.  
  566. =item Usage messages
  567.  
  568. Unlike "typical" warnings above, which warn about problems processing
  569. data, usage-warnings are for alerting developers of deprecated methods
  570. and suspicious invocations.
  571.  
  572. Usage messages are currently only logged if C<$^W> is set true
  573. and MIME::Tools is not configured to be L</quiet>.
  574.  
  575. =back
  576.  
  577. When a MIME::Parser (or one of its internal helper classes)
  578. wants to report a message, it generally does so by recording
  579. the message to the B<MIME::Parser::Results> object
  580. immediately before invoking the appropriate function above.
  581. That means each parsing run has its own trace-log which
  582. can be examined for problems.
  583.  
  584.  
  585. =head2 Configuring the toolkit
  586.  
  587. If you want to tweak the way this toolkit works (for example, to
  588. turn on debugging), use the routines in the B<MIME::Tools> module.
  589.  
  590. =over
  591.  
  592. =item debugging
  593.  
  594. Turn debugging on or off.
  595. Default is false (off).
  596.  
  597.      MIME::Tools->debugging(1);
  598.  
  599.  
  600. =item quiet
  601.  
  602. Turn the reporting of warning/error messages on or off.
  603. Default is true, meaning that these message are silenced.
  604.  
  605.      MIME::Tools->quiet(1);
  606.  
  607.  
  608. =item version
  609.  
  610. Return the toolkit version.
  611.  
  612.      print MIME::Tools->version, "\n";
  613.  
  614. =back
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623. =head1 THINGS YOU SHOULD DO
  624.  
  625.  
  626. =head2 Take a look at the examples
  627.  
  628. The MIME-Tools distribution comes with an "examples" directory.
  629. The scripts in there are basically just tossed-together, but
  630. they'll give you some ideas of how to use the parser.
  631.  
  632.  
  633. =head2 Run with warnings enabled
  634.  
  635. I<Always> run your Perl script with C<-w>.
  636. If you see a warning about a deprecated method, change your
  637. code ASAP.  This will ease upgrades tremendously.
  638.  
  639.  
  640. =head2 Avoid non-standard encodings
  641.  
  642. Don't try to MIME-encode using the non-standard MIME encodings.
  643. It's just not a good practice if you want people to be able to
  644. read your messages.
  645.  
  646.  
  647. =head2 Plan for thrown exceptions
  648.  
  649. For example, if your mail-handling code absolutely must not die,
  650. then perform mail parsing like this:
  651.  
  652.     $entity = eval { $parser->parse(\*INPUT) };
  653.  
  654. Parsing is a complex process, and some components may throw exceptions
  655. if seriously-bad things happen.  Since "seriously-bad" is in the
  656. eye of the beholder, you're better off I<catching> possible exceptions
  657. instead of asking me to propagate C<undef> up the stack.  Use of exceptions in
  658. reusable modules is one of those religious issues we're never all
  659. going to agree upon; thankfully, that's what C<eval{}> is good for.
  660.  
  661.  
  662. =head2 Check the parser results for warnings/errors
  663.  
  664. As of 5.3xx, the parser tries extremely hard to give you a
  665. MIME::Entity.  If there were any problems, it logs warnings/errors
  666. to the underlying "results" object (see L<MIME::Parser::Results>).
  667. Look at that object after each parse.
  668. Print out the warnings and errors, I<especially> if messages don't
  669. parse the way you thought they would.
  670.  
  671.  
  672. =head2 Don't plan on printing exactly what you parsed!
  673.  
  674. I<Parsing is a (slightly) lossy operation.>
  675. Because of things like ambiguities in base64-encoding, the following
  676. is I<not> going to spit out its input unchanged in all cases:
  677.  
  678.     $entity = $parser->parse(\*STDIN);
  679.     $entity->print(\*STDOUT);
  680.  
  681. If you're using MIME::Tools to process email, remember to save
  682. the data you parse if you want to send it on unchanged.
  683. This is vital for things like PGP-signed email.
  684.  
  685.  
  686. =head2 Understand how international characters are represented
  687.  
  688. The MIME standard allows for text strings in headers to contain
  689. characters from any character set, by using special sequences
  690. which look like this:
  691.  
  692.     =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?=
  693.  
  694. To be consistent with the existing Mail::Field classes, MIME::Tools
  695. does I<not> automatically unencode these strings, since doing so would
  696. lose the character-set information and interfere with the parsing
  697. of fields (see L<MIME::Parser/decode_headers> for a full explanation).
  698. That means you should be prepared to deal with these encoded strings.
  699.  
  700. The most common question then is, B<how do I decode these encoded strings?>
  701. The answer depends on what you want to decode them I<to>:
  702. ASCII, Latin1, UTF-8, etc.  Be aware that your "target" representation
  703. may not support all possible character sets you might encounter;
  704. for example, Latin1 (ISO-8859-1) has no way of representing Big5
  705. (Chinese) characters.  A common practice is to represent "untranslateable"
  706. characters as "?"s, or to ignore them completely.
  707.  
  708. To unencode the strings into some of the more-popular Western byte
  709. representations (e.g., Latin1, Latin2, etc.), you can use the decoders
  710. in MIME::WordDecoder (see L<MIME::WordDecoder>).
  711. The simplest way is by using C<unmime()>, a function wrapped
  712. around your "default" decoder, as follows:
  713.  
  714.     use MIME::WordDecoder;
  715.     ...
  716.     $subject = unmime $entity->head->get('subject');
  717.  
  718. One place this I<is> done automatically is in extracting the recommended
  719. filename for a part while parsing.  That's why you should start by
  720. setting up the best "default" decoder if the default target of Latin1
  721. isn't to your liking.
  722.  
  723.  
  724.  
  725. =head1 THINGS I DO THAT YOU SHOULD KNOW ABOUT
  726.  
  727.  
  728. =head2 Fuzzing of CRLF and newline on input
  729.  
  730. RFC-1521 dictates that MIME streams have lines terminated by CRLF
  731. (C<"\r\n">).  However, it is extremely likely that folks will want to
  732. parse MIME streams where each line ends in the local newline
  733. character C<"\n"> instead.
  734.  
  735. An attempt has been made to allow the parser to handle both CRLF
  736. and newline-terminated input.
  737.  
  738.  
  739. =head2 Fuzzing of CRLF and newline when decoding
  740.  
  741. The C<"7bit"> and C<"8bit"> decoders will decode both
  742. a C<"\n"> and a C<"\r\n"> end-of-line sequence into a C<"\n">.
  743.  
  744. The C<"binary"> decoder (default if no encoding specified)
  745. still outputs stuff verbatim... so a MIME message with CRLFs
  746. and no explicit encoding will be output as a text file
  747. that, on many systems, will have an annoying ^M at the end of
  748. each line... I<but this is as it should be>.
  749.  
  750.  
  751. =head2 Fuzzing of CRLF and newline when encoding/composing
  752.  
  753. All encoders currently output the end-of-line sequence as a C<"\n">,
  754. with the assumption that the local mail agent will perform
  755. the conversion from newline to CRLF when sending the mail.
  756. However, there probably should be an option to output CRLF as per RFC-1521.
  757.  
  758.  
  759. =head2 Inability to handle multipart boundaries with embedded newlines
  760.  
  761. Let's get something straight: this is an evil, EVIL practice.
  762. If your mailer creates multipart boundary strings that contain
  763. newlines, give it two weeks notice and find another one.  If your
  764. mail robot receives MIME mail like this, regard it as syntactically
  765. incorrect, which it is.
  766.  
  767.  
  768. =head2 Ignoring non-header headers
  769.  
  770. People like to hand the parser raw messages straight from
  771. POP3 or from a mailbox.  There is often predictable non-header
  772. information in front of the real headers; e.g., the initial
  773. "From" line in the following message:
  774.  
  775.     From - Wed Mar 22 02:13:18 2000
  776.     Return-Path: <eryq@zeegee.com>
  777.     Subject: Hello
  778.  
  779. The parser simply ignores such stuff quietly.  Perhaps it
  780. shouldn't, but most people seem to want that behavior.
  781.  
  782.  
  783. =head2 Fuzzing of empty multipart preambles
  784.  
  785. Please note that there is currently an ambiguity in the way
  786. preambles are parsed in.  The following message fragments I<both>
  787. are regarded as having an empty preamble (where C<\n> indicates a
  788. newline character):
  789.  
  790.      Content-type: multipart/mixed; boundary="xyz"\n
  791.      Subject: This message (#1) has an empty preamble\n
  792.      \n
  793.      --xyz\n
  794.      ...
  795.  
  796.      Content-type: multipart/mixed; boundary="xyz"\n
  797.      Subject: This message (#2) also has an empty preamble\n
  798.      \n
  799.      \n
  800.      --xyz\n
  801.      ...
  802.  
  803. In both cases, the I<first> completely-empty line (after the "Subject")
  804. marks the end of the header.
  805.  
  806. But we should clearly ignore the I<second> empty line in message #2,
  807. since it fills the role of I<"the newline which is only there to make
  808. sure that the boundary is at the beginning of a line">.
  809. Such newlines are I<never> part of the content preceding the boundary;
  810. thus, there is no preamble "content" in message #2.
  811.  
  812. However, it seems clear that message #1 I<also> has no preamble
  813. "content", and is in fact merely a compact representation of an
  814. empty preamble.
  815.  
  816.  
  817. =head2 Use of a temp file during parsing
  818.  
  819. I<Why not do everything in core?>
  820. Although the amount of core available on even a modest home
  821. system continues to grow, the size of attachments continues
  822. to grow with it.  I wanted to make sure that even users with small
  823. systems could deal with decoding multi-megabyte sounds and movie files.
  824. That means not being core-bound.
  825.  
  826. As of the released 5.3xx, MIME::Parser gets by with only
  827. one temp file open per parser.  This temp file provides
  828. a sort of infinite scratch space for dealing with the current
  829. message part.  It's fast and lightweight, but you should know
  830. about it anyway.
  831.  
  832.  
  833. =head2 Why do I assume that MIME objects are email objects?
  834.  
  835. Achim Bohnet once pointed out that MIME headers do nothing more than
  836. store a collection of attributes, and thus could be represented as
  837. objects which don't inherit from Mail::Header.
  838.  
  839. I agree in principle, but RFC-1521 says otherwise.
  840. RFC-1521 [MIME] headers are a syntactic subset of RFC-822 [email] headers.
  841. Perhaps a better name for these modules would have been RFC1521::
  842. instead of MIME::, but we're a little beyond that stage now.
  843.  
  844. When I originally wrote these modules for the CPAN, I agonized for a long
  845. time about whether or not they really should subclass from B<Mail::Internet>
  846. (then at version 1.17).  Thanks to Graham Barr, who graciously evolved
  847. MailTools 1.06 to be more MIME-friendly, unification was achieved
  848. at MIME-tools release 2.0.
  849. The benefits in reuse alone have been substantial.
  850.  
  851.  
  852.  
  853.  
  854. =head1 A MIME PRIMER
  855.  
  856. So you need to parse (or create) MIME, but you're not quite up on
  857. the specifics?  No problem...
  858.  
  859.  
  860.  
  861. =head2 Glossary
  862.  
  863. Here are some definitions adapted from RFC-1521 explaining the terminology
  864. we use; each is accompanied by the equivalent in MIME:: module terms...
  865.  
  866. =over 4
  867.  
  868. =item attachment
  869.  
  870. An "attachment" is common slang for any part of a multipart message --
  871. except, perhaps, for the first part, which normally carries a user
  872. message describing the attachments that follow (e.g.: "Hey dude, here's
  873. that GIF file I promised you.").
  874.  
  875. In our system, an attachment is just a B<MIME::Entity> under the
  876. top-level entity, probably one of its L<parts|MIME::Entity/parts>.
  877.  
  878. =item body
  879.  
  880. The "body" of an L<entity|/entity> is that portion of the entity
  881. which follows the L<header|/header> and which contains the real message
  882. content.  For example, if your MIME message has a GIF file attachment,
  883. then the body of that attachment is the base64-encoded GIF file itself.
  884.  
  885. A body is represented by an instance of B<MIME::Body>.  You get the
  886. body of an entity by sending it a L<bodyhandle()|MIME::Entity/bodyhandle>
  887. message.
  888.  
  889. =item body part
  890.  
  891. One of the parts of the body of a multipart B</entity>.
  892. A body part has a B</header> and a B</body>, so it makes sense to
  893. speak about the body of a body part.
  894.  
  895. Since a body part is just a kind of entity, it's represented by
  896. an instance of B<MIME::Entity>.
  897.  
  898. =item entity
  899.  
  900. An "entity" means either a B</message> or a B</body part>.
  901. All entities have a B</header> and a B</body>.
  902.  
  903. An entity is represented by an instance of B<MIME::Entity>.
  904. There are instance methods for recovering the
  905. L<header|MIME::Entity/head> (a B<MIME::Head>) and the
  906. L<body|MIME::Entity/bodyhandle> (a B<MIME::Body>).
  907.  
  908. =item header
  909.  
  910. This is the top portion of the MIME message, which contains the
  911. "Content-type", "Content-transfer-encoding", etc.  Every MIME entity has
  912. a header, represented by an instance of B<MIME::Head>.  You get the
  913. header of an entity by sending it a head() message.
  914.  
  915. =item message
  916.  
  917. A "message" generally means the complete (or "top-level") message being
  918. transferred on a network.
  919.  
  920. There currently is no explicit package for "messages"; under MIME::,
  921. messages are streams of data which may be read in from files or
  922. filehandles.  You can think of the B<MIME::Entity> returned by the
  923. B<MIME::Parser> as representing the full message.
  924.  
  925.  
  926. =back
  927.  
  928.  
  929. =head2 Content types
  930.  
  931. This indicates what kind of data is in the MIME message, usually
  932. as I<majortype/minortype>.  The standard major types are shown below.
  933. A more-comprehensive listing may be found in RFC-2046.
  934.  
  935. =over 4
  936.  
  937. =item application
  938.  
  939. Data which does not fit in any of the other categories, particularly
  940. data to be processed by some type of application program.
  941. C<application/octet-stream>, C<application/gzip>, C<application/postscript>...
  942.  
  943. =item audio
  944.  
  945. Audio data.
  946. C<audio/basic>...
  947.  
  948. =item image
  949.  
  950. Graphics data.
  951. C<image/gif>, C<image/jpeg>...
  952.  
  953. =item message
  954.  
  955. A message, usually another mail or MIME message.
  956. C<message/rfc822>...
  957.  
  958. =item multipart
  959.  
  960. A message containing other messages.
  961. C<multipart/mixed>, C<multipart/alternative>...
  962.  
  963. =item text
  964.  
  965. Textual data, meant for humans to read.
  966. C<text/plain>, C<text/html>...
  967.  
  968. =item video
  969.  
  970. Video or video+audio data.
  971. C<video/mpeg>...
  972.  
  973. =back
  974.  
  975.  
  976. =head2 Content transfer encodings
  977.  
  978. This is how the message body is packaged up for safe transit.
  979. There are the 5 major MIME encodings.
  980. A more-comprehensive listing may be found in RFC-2045.
  981.  
  982. =over 4
  983.  
  984. =item 7bit
  985.  
  986. No encoding is done at all.  This label simply asserts that no
  987. 8-bit characters are present, and that lines do not exceed 1000 characters
  988. in length (including the CRLF).
  989.  
  990. =item 8bit
  991.  
  992. No encoding is done at all.  This label simply asserts that the message
  993. might contain 8-bit characters, and that lines do not exceed 1000 characters
  994. in length (including the CRLF).
  995.  
  996. =item binary
  997.  
  998. No encoding is done at all.  This label simply asserts that the message
  999. might contain 8-bit characters, and that lines may exceed 1000 characters
  1000. in length.  Such messages are the I<least> likely to get through mail
  1001. gateways.
  1002.  
  1003. =item base64
  1004.  
  1005. A standard encoding, which maps arbitrary binary data to the 7bit domain.
  1006. Like "uuencode", but very well-defined.  This is how you should send
  1007. essentially binary information (tar files, GIFs, JPEGs, etc.).
  1008.  
  1009. =item quoted-printable
  1010.  
  1011. A standard encoding, which maps arbitrary line-oriented data to the
  1012. 7bit domain.  Useful for encoding messages which are textual in
  1013. nature, yet which contain non-ASCII characters (e.g., Latin-1,
  1014. Latin-2, or any other 8-bit alphabet).
  1015.  
  1016. =back
  1017.  
  1018.  
  1019.  
  1020.  
  1021. =head1 TERMS AND CONDITIONS
  1022.  
  1023. Eryq (F<eryq@zeegee.com>), ZeeGee Software Inc (F<http://www.zeegee.com>).
  1024.  
  1025. Copyright (c) 1998, 1999 by ZeeGee Software Inc (www.zeegee.com).
  1026.  
  1027. All rights reserved.  This program is free software; you can redistribute
  1028. it and/or modify it under the same terms as Perl itself.
  1029. See the COPYING file in the distribution for details.
  1030.  
  1031.  
  1032.  
  1033. =head1 SUPPORT
  1034.  
  1035. Please email me directly with questions/problems (see AUTHOR below).
  1036.  
  1037. If you want to be placed on an email distribution list (not a mailing list!)
  1038. for MIME-tools, and receive bug reports, patches, and updates as to when new
  1039. MIME-tools releases are planned, just email me and say so.  If your project
  1040. is using MIME-tools, it might not be a bad idea to find out about those
  1041. bugs I<before> they become problems...
  1042.  
  1043.  
  1044. =head1 VERSION
  1045.  
  1046. $Revision: 5.411 $
  1047.  
  1048.  
  1049. =head1 CHANGE LOG
  1050.  
  1051. =over 4
  1052.  
  1053. =item Version 5.411
  1054.  
  1055. B<Regenerated docs.>
  1056. Bug in HTML docs, now all fixed.
  1057.  
  1058. =item Version 5.410   (2000/11/23)
  1059.  
  1060. B<Better detection of evil filenames.>
  1061. Now we check for filenames which are suspiciously long,
  1062. and a new MIME::Filer::exorcise_filename() method is used
  1063. to try and remove the evil.
  1064. I<Thanks to Jason Haar for the suggestion.>
  1065.  
  1066.  
  1067. =item Version 5.409   (2000/11/12)
  1068.  
  1069. B<Added functionality to MIME::WordDecoder,>
  1070. including support for plain US-ASCII.
  1071.  
  1072. B<MIME::Tools::tmpopen()> made more flexible.
  1073. You can now override the tmpfile-opening behavior.
  1074.  
  1075.  
  1076. =item Version 5.408   (2000/11/10)
  1077.  
  1078. B<Added new Beta unmime() mechanism.>
  1079. See L<MIME::WordDecoder> for full details.
  1080. Also see L<"Understand how international characters are represented">.
  1081.  
  1082.  
  1083. =item Version 5.405   (2000/11/05)
  1084.  
  1085. B<Added a purge() that does what people want it to.>
  1086. Now, when a parse finishes and you want to delete everything that
  1087. was created by it, you can invoke C<purge()> on the parser's filer.
  1088. All files/directories created during the last parse should vanish.
  1089. I<Thanks to everyone who complained about MIME::Entity::purge.>
  1090.  
  1091.  
  1092. =item Version 5.404   (2000/11/04)
  1093.  
  1094. B<Added new automatic MIME-decoding of attachment filenames with
  1095. encoded (non-ASCII) characters.>
  1096. Hopefully this will do more good than harm.
  1097. The use of MIME::Parser::decode_headers() and MIME::Head::decode()
  1098. has been deprecated in favor of the new MIME::Words "unmime" mechanism.
  1099. Please see L<MIME::Words/unmime>.
  1100.  
  1101. B<Added tolerance for unquoted =?...?= in param values.>
  1102. This is in violation of the RFCs, but then, so are some MUAs.
  1103. I<Thanks to desti for bringing this to my attention.>
  1104.  
  1105. B<Fixed supposedly-bad B-encoding.>
  1106. I<Thanks to Otto Frost for bringing this to my attention.>
  1107.  
  1108.  
  1109. =item Version 5.316   (2000/09/21)
  1110.  
  1111. B<Increased tolerance in MIME::Parser.>
  1112. Now will ignore bogus POP3 "+OK" line before header, as well as bogus
  1113. mailbox "From " line (both with warnings).
  1114. I<Thanks to Antony OSullivan (ajos1) for suggesting this feature.>
  1115.  
  1116. B<Fixed small epilogue-related bug in MIME::Entity::print_body().>
  1117. Now it only outputs a final newline if the epilogue does not end
  1118. in one already.  Support for checking the preamble/epilogue in
  1119. regression tests was also added.
  1120. I<Thanks to Lars Hecking for bringing this issue up.>
  1121.  
  1122. B<Updated documentation.>
  1123. All module manual pages should now direct readers to the main
  1124. MIME-tools manual page.
  1125.  
  1126.  
  1127. =item Version 5.314   (2000/09/06)
  1128.  
  1129. Fixed Makefile.PL to have less-restrictive requirement
  1130. for File::Spec (0.6).
  1131.  
  1132.  
  1133. =item Version 5.313   (2000/09/05)
  1134.  
  1135. B<Fixed nasty bug with evil filenames.>
  1136. Certain evil filenames were getting replaced by internally-generated
  1137. filenames which were just as evil... ouch!  If your parser occasionally
  1138. throws a fatal exception with a "write-open" error message, then
  1139. you have this bug.
  1140. I<Thanks to Julian Field and Antony OSullivan (ajos1)
  1141. for delivering the evidence!>
  1142.  
  1143.        Beware the doctor
  1144.           who cures seasonal head cold
  1145.        by killing patient
  1146.  
  1147. B<Improved naming of extracted files.>
  1148. If a filename is regarded as evil, we guess that it might just
  1149. be because of part information, and attempt to find and use the
  1150. final path element.
  1151.  
  1152. B<Simplified message logging and made it more consistent.>
  1153. For details, see L<"Message-logging">.
  1154.  
  1155.  
  1156. =item Version 5.312   (2000/09/03)
  1157.  
  1158. B<Fixed a Perl 5.7 select() incompatibility>
  1159. which caused "make test" to fail.
  1160. I<Thanks to Nick Ing-Simmons for the patch.>
  1161.  
  1162.  
  1163. =item Version 5.311   (2000/08/16)
  1164.  
  1165. B<Blind fix for Win32 uudecoding bug.>
  1166. A missing binmode seems to be the culprit here; let's see if this fixes it.
  1167. I<Thanks to ajos1 for finding the culprit!>
  1168.  
  1169.        The carriage return
  1170.           thumbs its nose at me, laughing:
  1171.        DOS I/O *still* sucks
  1172.  
  1173.  
  1174. =item Version 5.310   (2000/08/15)
  1175.  
  1176. B<Fixed a bug in the back-compat output_prefix() method of MIME::Parser.>
  1177. Basically, output prefixes were not being set through this mechanism.
  1178. I<Thanks to ajos1 for the alert.>
  1179.  
  1180.     shift @_,                               ### "shift at-underscore"
  1181.        or @_ will have
  1182.     bogus "self" object
  1183.  
  1184. B<Added some backcompat methods,> like parse_FH().
  1185. I<Thanks (and apologies) to Alain Kotoujansky.>
  1186.  
  1187. B<Added filenames-with-spaces support to MIME::Decoder::UU.>
  1188. I<Thanks to Richard Pun for the suggestion.>
  1189.  
  1190.  
  1191. =item Version 5.305   (2000/07/20)
  1192.  
  1193. B<Added MIME::Entity::parts_DFS> as convenient way to "get all parts".
  1194. I<Thanks to Xavier Armengou for suggesting this method.>
  1195.  
  1196. Removed the Alpha notice.
  1197. Still a few features to tweak, but those will be minor.
  1198.  
  1199.  
  1200. =item Version 5.303   (2000/07/07)
  1201.  
  1202. B<Fixed output bugs in new Filers>.
  1203. Scads of them: bad handling of filename collisions, bad implementation
  1204. of output_under(), bad linking to results, POD errors, you name it.
  1205. If this had gone to CPAN, I'd have issued a factory recall. C<:-(>
  1206.  
  1207.        Errors, like beetles,
  1208.           Multiply ferociously
  1209.        In the small hours
  1210.  
  1211.  
  1212. =item Version 5.301   (2000/07/06)
  1213.  
  1214. B<READ ME BEFORE UPGRADING PAST THIS POINT!>
  1215. B<New MIME::Parser::Filer class -- not fully backwards-compatible.>
  1216. In response to demand for more-comprehensive file-output strategies,
  1217. I have decided that the best thing to do is to split all the
  1218. file-output logic (output_path(), evil_filename(), etc.)
  1219. into its own separate class, inheriting from the new
  1220. L<MIME::Parser::Filer|MIME::Parser::Filer> class.
  1221. If you I<override> any of the following in a MIME::Parser subclass,
  1222. you will need to change your code accordingly:
  1223.  
  1224.     evil_filename
  1225.     output_dir
  1226.     output_filename
  1227.     output_path
  1228.     output_prefix
  1229.     output_under
  1230.  
  1231. My sincere apologies for any inconvenience this will cause, but
  1232. it's ultimately for the best, and is quite likely the last structural
  1233. change to 5.x.
  1234. I<Thanks to Tyson Ackland for all the ideas.>
  1235. Incidentally, the new code also fixes a bug where identically-named
  1236. files in the same message could clobber each other.
  1237.  
  1238.        A message arrives:
  1239.            "Here are three files, all named 'Foo'"
  1240.        Only one survives.  :-(
  1241.  
  1242. B<Fixed bug in MIME::Words header decoding.>
  1243. Underscores were not being handled properly.
  1244. I<Thanks to Dominique Unruh and Doru Petrescu,> who independently
  1245. submitted the same fix within 2 hours of each other, after this
  1246. bug has lain dormant for months:
  1247.  
  1248.        Two users, same bug,
  1249.           same patch -- mere hours apart:
  1250.        Truly, life is odd.
  1251.  
  1252. B<Removed escaping of underscore in regexps.>
  1253. Escaping the underscore (\_) in regexps was sloppy and wrong
  1254. (escaped metacharacters may include anything in \w), and the newest
  1255. Perls warn about it.
  1256. I<Thanks to David Dyck for bringing this to my attention.>
  1257.  
  1258.        What, then, is a word?
  1259.       Some letters, digits, and, yes:
  1260.        Underscores as well
  1261.  
  1262. B<Added Force option to MIME::Entity's make_multipart>.
  1263. I<Thanks to Bob Glickstein for suggesting this.>
  1264.  
  1265. B<Numerous fixlets to example code.>
  1266. I<Thanks to Doru Petrescu for these.>
  1267.  
  1268. B<Added REQUIREMENTS section in docs.>
  1269. Long-overdue.  I<Thanks to Ingo Schmiegel for motivating this.>
  1270.  
  1271.  
  1272. =item Version 5.211   (2000/06/24)
  1273.  
  1274. B<Fixed auto-uudecode bug.>
  1275. Parser was failing with "part did not end with expected boundary" error
  1276. when uuencoded entity was a I<singlepart> message (ironically,
  1277. uuencoded parts of multiparts worked fine).
  1278. I<Thanks to Michael Mohlere for testing uudecode and finding this.>
  1279.  
  1280.        The hurrying bee
  1281.           Flies far for nectar, missing
  1282.        The nearest flowers
  1283.  
  1284.        Say ten thousand times:
  1285.           Complex cases may succeed
  1286.        Where simple ones fail
  1287.  
  1288. B<Parse errors now generate warnings.>
  1289. Parser errors now cause warn()s to be generated if they are
  1290. not turned into fatal exceptions.  This might be a little redundant,
  1291. seeing as they are available in the "results", but parser-warnings
  1292. already cause warn()s.  I can always put in a "quiet" switch if
  1293. people complain.
  1294.  
  1295. B<Miscellaneous cleanup.>
  1296. Documentation of MIME::Parser improved slightly, and a redundant
  1297. warning was removed.
  1298.  
  1299.  
  1300. =item Version 5.210   (2000/06/20)
  1301.  
  1302. B<Change in "evil" filename.>
  1303. Made MIME::Parser's evil_filename stricter by having it reject
  1304. "path" characters: any of '/' '\' ':' '[' ']'.
  1305.  
  1306.        Just as with beauty
  1307.       The eye of the beholder
  1308.        Is where "evil" lives.
  1309.  
  1310. B<Documentation fixes.>
  1311. Corrected a number of docs in MIME::Entity which were obsoleted
  1312. in the transition from 4.x to 5.x.
  1313. I<Thanks to Michael Fischer for pointing these out.>
  1314. For this one, a special 5-5-5-5 Haiku of anagrams:
  1315.  
  1316.        Documentation
  1317.       in mutant code, O!
  1318.        Edit -- no, CUT! [moan]
  1319.       I meant to un-doc...
  1320.  
  1321. B<IO::Lines usage bug fixed.>
  1322. MIME::Entity was missing a "use IO::Lines", which caused an
  1323. exception when you tried to use the body() method of MIME::Entity.
  1324. I<Thanks to Hideyo Imazu and Michael Fischer for pointing this out.>
  1325.  
  1326.        Bareword looks fine, but
  1327.           Perl cries: "Whoa there... IO::Lines?
  1328.        Never heard of it."
  1329.  
  1330.  
  1331. =item Version 5.209   (2000/06/10)
  1332.  
  1333. B<Autodetection of uuencode.>
  1334. You can now tell the parser to hunt for uuencode inside what should
  1335. be text parts.
  1336. See L<extract_uuencode()|MIME::Parser/extract_uuencode> for full details.
  1337. B<Beware:> this is largely untested at the moment.
  1338. I<Special thanks to Michael Mohlere at ADJE Webmail, who was the
  1339.   first -- and most-insistent -- user to request this feature.>
  1340.  
  1341. B<Faster parsing.>
  1342. Sped up the MIME::Decoder::NBit decoder quite a bit by using a variant
  1343. of the chunking trick I used for MIME::Decoder::Base64.  I suspect
  1344. that the same trick (reading a big chunk plus the next line to get a
  1345. big block of lines) would work with MIME::Decoder::QuotedPrint, but I
  1346. don't have the time or resources to check that right now (tested
  1347. contributions would be welcome).  NBit encoding is more-conveniently
  1348. done line-by-line for now, because individual line lengths must be
  1349. checked.
  1350.  
  1351. B<Better use of core.>
  1352. MIME::Body::InCore is now used when you build() an entity with
  1353. the Data parameter, instead of MIME::Body::Scalar.
  1354.  
  1355. B<More documentation> on toolkit configuration.
  1356.  
  1357.  
  1358. =item Version 5.207   (2000/06/09)
  1359.  
  1360. B<Fixed whine() bug in MIME::Parser> where the "warning" method
  1361. whine() was called as a static function instead of invoked as an
  1362. instance method.
  1363. I<Thanks to Todd A. Bradfute for reporting this.>
  1364.  
  1365.        A simple warning
  1366.           Invokes method as function:
  1367.        "Warning" makes us die
  1368.  
  1369.  
  1370. =item Version 5.206   (2000/06/08)
  1371.  
  1372. Ahem.  Cough cough:
  1373.  
  1374.        Way too many bugs
  1375.           Thus, a self-imposed penance:
  1376.        Write haiku for each
  1377.  
  1378. B<Fixed bug in MIME::Parser:> the reader was not handling the odd
  1379. (but legal) case where a multipart boundary is followed by linear
  1380. whitespace.
  1381. I<Thanks to Jon Agnew for reporting this with the RFC citation.>
  1382.  
  1383.        Legal message fails
  1384.           And 'round the globe, thousands cry:
  1385.        READ THE RFC
  1386.  
  1387. Empty preambles are now handled properly by MIME::Entity when
  1388. printing: there is now no space between the header-terminator
  1389. and the initial boundary.
  1390. I<Thanks to "sen_ml" for suggesting this.>
  1391.  
  1392.        Nature hates vacuum
  1393.           But please refrain from tossing
  1394.        Newlines in the void
  1395.  
  1396. Started using Benchmark for benchmarking.
  1397.  
  1398.  
  1399. =item Version 5.205   (2000/06/06)
  1400.  
  1401. Added terminating newline to all parser messages, and fixed
  1402. small parser bug that was dropping parts when errors occurred
  1403. in certain places.
  1404.  
  1405.  
  1406. =item Version 5.203   (2000/06/05)
  1407.  
  1408. Brand new parser based on new (private) MIME::Parser::Reader and
  1409. (public) MIME::Parser::Results.  Fast and yet simple and very tolerant
  1410. of bad MIME when desired.  Message reporting needs some muzzling.
  1411.  
  1412. MIME::Parser now has ignore_errors() set true by default.
  1413.  
  1414.  
  1415. =item Version 5.116   (2000/05/26)
  1416.  
  1417. Removed Tmpfile.t test, which was causing a bogus failure in
  1418. "make test".  Now we require 5.004 for MIME::Parser anyway,
  1419. so we don't need it.  I<Thanks to Jonathan Cohn for reporting this.>
  1420.  
  1421.  
  1422. =item Version 5.115   (2000/05/24)
  1423.  
  1424. Fixed Ref.t bug, and documented how to remove parts from a MIME::Entity.
  1425.  
  1426.  
  1427. =item Version 5.114   (2000/05/23)
  1428.  
  1429. Entity now uses MIME::Lite-style default suggested encoding.
  1430.  
  1431. More regression test have been added, and the "Size" tests in
  1432. Ref.t are skipped for text document (due to CRLF differences
  1433. between platforms).
  1434.  
  1435.  
  1436. =item Version 5.113   (2000/05/21)
  1437.  
  1438. B<Major speed and structural improvements to the parser.>
  1439.     I<Major, MAJOR thanks to Noel Burton-Krahn, Jeremy Gilbert,
  1440.       and Doru Petrescu for all the patches, benchmarking,
  1441.       and Beta-testing!>
  1442.  
  1443. B<Convenient new one-directory-per-message parsing mechanism.>
  1444.     Now through C<MIME::Parser> method C<output_under()>,
  1445.     you can tell the parser that you want it to create
  1446.     a unique directory for each message parsed, to hold the
  1447.     resulting parts.
  1448.  
  1449. B<Elimination of $', $` and $&.>
  1450.     Wow... I still can't believe I missed this.  D'OH!
  1451.     I<Thanks to Noel Burton-Krahn for all his patches.>
  1452.  
  1453. B<Parser is more tolerant of weird EOL termination.>
  1454.     Some mailagents are can terminate lines with "\r\r\n".
  1455.     We're okay with that now when we extract the header.
  1456.     I<Thanks to Joao Fonseca for pointing this out.>
  1457.  
  1458. B<Parser is tolerant of "From " lines in headers.>
  1459.     I<Thanks to Joachim Wieland, Anthony Hinsinger, Marius Stan,
  1460.       and numerous others.>
  1461.  
  1462. B<Parser catches syntax errors in headers.>
  1463.     I<Thanks to Russell P. Sutherland for catching this.>
  1464.  
  1465. B<Parser no longer warns when subtype is undefined.>
  1466.     I<Thanks to Eric-Olivier Le Bigot for his fix.>
  1467.  
  1468. B<Better integration with Mail::Internet.>
  1469.     For example, smtpsend() should work fine.
  1470.     I<Thanks to Michael Fischer and others for the patch.>
  1471.  
  1472. B<Miscellaneous cleanup.>
  1473.     I<Thanks to Marcus Brinkmann for additional helpful input.>
  1474.     I<Thanks to Klaus Seidenfaden for good feedback on 5.x Alpha!>
  1475.  
  1476.  
  1477.  
  1478.  
  1479. =item Version 4.123   (1999/05/12)
  1480.  
  1481. Cleaned up some of the tests for non-Unix OS'es.
  1482. Will require a few iterations, no doubt.
  1483.  
  1484.  
  1485. =item Version 4.122   (1999/02/09)
  1486.  
  1487. B<Resolved CORE::open warnings for 5.005.>
  1488.         I<Thanks to several folks for this bug report.>
  1489.  
  1490.  
  1491. =item Version 4.121   (1998/06/03)
  1492.  
  1493. B<Fixed MIME::Words infinite recursion.>
  1494.         I<Thanks to several folks for this bug report.>
  1495.  
  1496.  
  1497. =item Version 4.117   (1998/05/01)
  1498.  
  1499. B<Nicer MIME::Entity::build.>
  1500.         No longer outputs warnings with undefined Filename, and now
  1501.         accepts Charset as well.
  1502.     I<Thanks to Jason Tibbits III for the inspirational patch.>
  1503.  
  1504. B<Documentation fixes.>
  1505.         Hopefully we've seen the last of the pod2man warnings...
  1506.  
  1507. B<Better test logging.>
  1508.         Now uses ExtUtils::TBone.
  1509.  
  1510.  
  1511. =item Version 4.116   (1998/02/14)
  1512.  
  1513. B<Bug fix:>
  1514.         MIME::Head and MIME::Entity were not downcasing the
  1515.         content-type as they claimed.  This has now been fixed.
  1516.     I<Thanks to Rodrigo de Almeida Siqueira for finding this.>
  1517.  
  1518.  
  1519. =item Version 4.114   (1998/02/12)
  1520.  
  1521. B<Gzip64-encoding has been improved, and turned off as a default,>
  1522.     since it depends on having gzip installed.
  1523.         See MIME::Decoder::Gzip64 if you want to activate it in your app.
  1524.     You can    now set up the gzip/gunzip commands to use, as well.
  1525.     I<Thanks to Paul J. Schinder for finding this bug.>
  1526.  
  1527.  
  1528. =item Version 4.113   (1998/01/20)
  1529.  
  1530. B<Bug fix:>
  1531.         MIME::ParserBase was accidentally folding newlines in header fields.
  1532.     I<Thanks to Jason L. Tibbitts III for spotting this.>
  1533.  
  1534.  
  1535. =item Version 4.112   (1998/01/17)
  1536.  
  1537. B<MIME::Entity::print_body now recurses> when printing multipart
  1538.     entities, and prints "everything following the header."  This is more
  1539.     likely what people expect to happen.  PLEASE read the
  1540.         "two body problem" section of MIME::Entity's docs.
  1541.  
  1542.  
  1543. =item Version 4.111   (1998/01/14)
  1544.  
  1545. Clean build/test on Win95 using 5.004.  Whew.
  1546.  
  1547.  
  1548. =item Version 4.110   (1998/01/11)
  1549.  
  1550. B<Added> make_multipart() and make_singlepart() in MIME::Entity.
  1551.  
  1552. B<Improved> handling/saving of preamble/epilogue.
  1553.  
  1554.  
  1555. =item Version 4.109   (1998/01/10)
  1556.  
  1557. =over 4
  1558.  
  1559. =item Overall
  1560.  
  1561. B<Major version shift to 4.x>
  1562.     accompanies numerous structural changes, and
  1563.     the deletion of some long-deprecated code.  Many apologies to those
  1564.     who are inconvenienced by the upgrade.
  1565.  
  1566. B<MIME::IO deprecated.>
  1567.     You'll see IO::Scalar, IO::ScalarArray, and IO::Wrap
  1568.     to make this toolkit work.
  1569.  
  1570. B<MIME::Entity deep code.>
  1571.     You can now deep-copy MIME entities (except for on-disk data files).
  1572.  
  1573.  
  1574. =item Encoding/decoding
  1575.  
  1576. B<MIME::Latin1 deprecated, and 8-to-7 mapping removed.>
  1577.     Really, MIME::Latin1 was one of my more dumber ideas.
  1578.     It's still there, but if you want to map 8-bit characters to
  1579.     Latin1 ASCII approximations when 7bit encoding, you'll have to
  1580.     request it explicitly.    I<But use quoted-printable for your 8-bit
  1581.     documents; that's what it's there for!>
  1582.  
  1583. B<7bit and 8bit "encoders" no longer encode.>
  1584.     As per RFC-2045, these just do a pass-through of the data,
  1585.     but they'll warn you if you send bad data through.
  1586.  
  1587. B<MIME::Entity suggests encoding.>
  1588.     Now you can ask MIME::Entity's build() method to "suggest"
  1589.     a legal encoding based on the body and the content-type.
  1590.     No more guesswork!  See the "mimesend" example.
  1591.  
  1592. B<New module structure for MIME::Decoder classes.>
  1593.     It should be easier for you to see what's happening.
  1594.  
  1595. B<New MIME decoders!>
  1596.     Support added for decoding C<x-uuencode>, and for
  1597.     decoding/encoding C<x-gzip64>.  You'll need "gzip" to make
  1598.     the latter work.
  1599.  
  1600. B<Quoted-printable back on track... and then some.>
  1601.     The 'quoted-printable' decoder now uses the newest MIME::QuotedPrint,
  1602.     and amends its output with guideline #8 from RFC2049 (From/.).
  1603.     I<Thanks to Denis N. Antonioli for suggesting this.>
  1604.  
  1605. =item Parsing
  1606.  
  1607. B<Preamble and epilogue are now saved.>
  1608.     These are saved in the parsed entities as simple
  1609.     string-arrays, and are output by print() if there.
  1610.     I<Thanks to Jason L. Tibbitts for suggesting this.>
  1611.  
  1612. B<The "multipart/digest" semantics are now preserved.>
  1613.     Parts of digest messages have their mime_type() defaulted
  1614.     to "message/rfc822" instead of "text/plain", as per the RFC.
  1615.     I<Thanks to Carsten Heyl for suggesting this.>
  1616.  
  1617. =item Output
  1618.  
  1619. B<Well-defined, more-complete print() output.>
  1620.     When printing an entity, the output is now well-defined if the
  1621.     entity came from a MIME::Parser, even if using parse_nested_messages.
  1622.     See MIME::Entity for details.
  1623.  
  1624. B<You can prevent recommended filenames from being output.>
  1625.     This possible security hole has been plugged; when building MIME
  1626.     entities, you can specify a body path but suppress the filename
  1627.     in the header.
  1628.     I<Thanks to Jason L. Tibbitts for suggesting this.>
  1629.  
  1630. =item Bug fixes
  1631.  
  1632. B<Win32 installations should work.>
  1633.     The binmode() calls should work fine on Win32 now.
  1634.     I<Thanks to numerous folks for their patches.>
  1635.  
  1636. B<MIME::Head::add()> now no longer downcases its argument.
  1637.     I<Thanks to Brandon Browning & Jason L. Tibbitts for finding this bug.>
  1638.  
  1639. =back
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646. =item Version 3.204
  1647.  
  1648. B<Bug in MIME::Head::original_text fixed.>
  1649.     Well, it took a while, but another bug surfaced from my transition
  1650.     from 1.x to 2.x.  This method was, quite idiotically, sorting the
  1651.     header fields.
  1652.     I<Thanks, as usual, to Andreas Koenig for spotting this one.>
  1653.  
  1654. B<MIME::ParserBase no longer defaults to RFC-1522-decoding headers.>
  1655.     The documentation correctly stated that the default setting was
  1656.     to I<not> RFC-1522-decode the headers.  The code, on the other hand,
  1657.     was init'ing this parser option in the "on" position.
  1658.     This has been fixed.
  1659.  
  1660. B<MIME::ParserBase::parse_nested_messages reexamined.>
  1661.     If you use this feature, please re-read the documentation.
  1662.     It explains a little more precisely what the ramifications are.
  1663.  
  1664. B<MIME::Entity tries harder to ensure MIME compliance.>
  1665.     It is now a fatal error to use certain bad combinations of content
  1666.     type and encoding when "building", or to attempt to "attach" to
  1667.     anything that is not a multipart document.  My apologies if this
  1668.     inconveniences anyone, but it was just too darn easy before for folks
  1669.     to create bad MIME, and gosh darn it, good libraries should at least
  1670.     I<try> to protect you from mistakes.
  1671.  
  1672. B<The "make" now halts if you don't have the right stuff,>
  1673.     provided your MakeMaker supports PREREQ_PM.  See L<"REQUIREMENTS">
  1674.     for what you need to install this package.  I still provide
  1675.     old courtesy copies of the MIME:: decoding modules.
  1676. I<Thanks to Hugo van der Sanden for suggesting this.>
  1677.  
  1678. B<The "make test" is far less chatty.>
  1679.     Okay, okay, STDERR is evil.  Now a C<"make test"> will just give you
  1680.     the important stuff: do a C<"make test TEST_VERBOSE=1"> if you want
  1681.     the gory details (advisable if sending me a bug report).
  1682. I<Thanks to Andreas Koenig for suggesting this.>
  1683.  
  1684.  
  1685. =item Version 3.203
  1686.  
  1687. B<No, there haven't been any major changes between 2.x and 3.x.>
  1688.     The major-version increase was from a few more tweaks to get $VERSION
  1689.     to be calculated better and more efficiently (I had been using RCS
  1690.     version numbers in a way which created problems for users of CPAN::).
  1691.     After a couple of false starts, all modules have been upgraded to RCS
  1692.     3.201 or higher.
  1693.  
  1694. B<You can now parse a MIME message from a scalar,>
  1695.     an array-of-scalars, or any MIME::IO-compliant object (including IO::
  1696.     objects.)  Take a look at parse_data() in MIME::ParserBase.  The
  1697.     parser code has been modified to support the MIME::IO interface.
  1698.     I<Thanks to fellow Chicagoan Tim Pierce (and countless others)
  1699.     for asking.>
  1700.  
  1701. B<More sensible toolkit configuration.>
  1702.     A new config() method in MIME::ToolUtils makes a lot of toolkit-wide
  1703.     configuration cleaner.  Your old calls will still work, but with
  1704.     deprecation warnings.
  1705.  
  1706. B<You can now sign messages> just like in Mail::Internet.
  1707.     See MIME::Entity for the interface.
  1708.  
  1709. B<You can now remove signatures from messages> just like in Mail::Internet.
  1710.     See MIME::Entity for the interface.
  1711.  
  1712. B<You can now compute/strip content lengths>
  1713.     and other non-standard MIME fields.
  1714.     See sync_headers() in MIME::Entity.
  1715.     I<Thanks to Tim Pierce for bringing the basic problem to my attention.>
  1716.  
  1717. B<Many warnings are now silent unless $^W is true.>
  1718.     That means unless you run your Perl with C<-w>, you won't see
  1719.         deprecation warnings, non-fatal-error messages, etc.
  1720.         But of course you run with C<-w>, so this doesn't affect you.  C<:-)>
  1721.  
  1722. B<Completed the 7-bit encodings in MIME::Latin1.>
  1723.     We hadn't had complete coverage in the conversion from 8- to 7-bit;
  1724.     now we do. I<Thanks to Rolf Nelson for bringing this to my attention.>
  1725.  
  1726. B<Fixed broken parse_two() in MIME::ParserBase.>
  1727.     BTW, if your code worked with the "broken" code, it should I<still>
  1728.     work.
  1729.     I<Thanks again to Tim Pierce for bringing this to my attention.>
  1730.  
  1731.  
  1732. =item Version 2.14
  1733.  
  1734. Just a few bug fixes to improve compatibility with Mail-Tools 1.08,
  1735. and with the upcoming Perl 5.004 release.
  1736. I<Thanks to Jason L. Tibbitts III for reporting the problems so quickly.>
  1737.  
  1738.  
  1739. =item Version 2.13
  1740.  
  1741. =over 4
  1742.  
  1743. =item New features
  1744.  
  1745. B<Added RFC-1522-style decoding of encoded header fields.>
  1746.     Header decoding can now be done automatically during parsing via the
  1747.     new C<decode()> method in MIME::Head... just tell your parser
  1748.     object that you want to C<decode_headers()>.
  1749.     I<Thanks to Kent Boortz for providing the idea, and the baseline
  1750.     RFC-1522-decoding code!>
  1751.  
  1752. B<Building MIME messages is even easier.>
  1753.     Now, when you use MIME::Entity's C<build()> or C<attach()>,
  1754.     you can also supply individual
  1755.     mail headers to set (e.g., C<-Subject>, C<-From>, C<-To>).
  1756.  
  1757. Added C<Disposition> to MIME::Entity's C<build()> method.
  1758.     I<Thanks to Kurt Freytag for suggesting this feature.>
  1759.  
  1760. An C<X-Mailer> header is now output
  1761.     by default in all MIME-Entity-prepared messages,
  1762.     so any bad MIME we generate can be traced back to this toolkit.
  1763.  
  1764. Added C<purge()> method to MIME::Entity for deleteing leftover files.
  1765.     I<Thanks to Jason L. Tibbitts III for suggesting this feature.>
  1766.  
  1767. Added C<seek()> and C<tell()> methods to built-in MIME::IO classes.
  1768.     Only guaranteed to work when reading!
  1769.     I<Thanks to Jason L. Tibbitts III for suggesting this feature.>
  1770.  
  1771. When parsing a multipart message with apparently no boundaries,
  1772.     the error message you get has been improved.
  1773.     I<Thanks to Andreas Koenig for suggesting this.>
  1774.  
  1775. =item Bug fixes
  1776.  
  1777. B<Patched over a Perl 5.002 (and maybe earlier and later) bug involving
  1778. FileHandle::new_tmpfile.>  It seems that the underlying filehandles
  1779. were not being closed when the FileHandle objects went out of scope!
  1780. There is now an internal routine that creates true FileHandle
  1781. objects for anonymous temp files.
  1782. I<Thanks to Dragomir R. Radev and Zyx for reporting the weird behavior
  1783. that led to the discovery of this bug.>
  1784.  
  1785. MIME::Entity's C<build()> method now warns you if you give it an illegal
  1786. boundary string, and substitutes one of its own.
  1787.  
  1788. MIME::Entity's C<build()> method now generates safer, fully-RFC-1521-compliant
  1789. boundary strings.
  1790.  
  1791. Bug in MIME::Decoder's C<install()> method was fixed.
  1792. I<Thanks to Rolf Nelson and Nickolay Saukh for finding this.>
  1793.  
  1794. Changed FileHandle::new_tmpfile to FileHandle->new_tmpfile, so some
  1795. Perl installations will be happier.
  1796. I<Thanks to Larry W. Virden for finding this bug.>
  1797.  
  1798. Gave C<=over> an arg of 4 in all PODs.
  1799. I<Thanks to Larry W. Virden for pointing out the problems of bare =over's>
  1800.  
  1801. =back
  1802.  
  1803.  
  1804. =item Version 2.04
  1805.  
  1806. B<A bug in MIME::Entity's output method was corrected.>
  1807. MIME::Entity::print now outputs everything to the desired filehandle
  1808. explicitly.
  1809. I<Thanks to Jake Morrison for pointing out the incompatibility
  1810. with Mail::Header.>
  1811.  
  1812.  
  1813. =item Version 2.03
  1814.  
  1815. B<Fixed bug in autogenerated filenames> resulting from transposed "if"
  1816. statement in MIME::Parser, removing spurious printing of header as well.
  1817. (Annoyingly, this bug is invisible if debugging is turned on!)
  1818. I<Thanks to Andreas Koenig for bringing this to my attention.>
  1819.  
  1820. Fixed bug in MIME::Entity::body() where it was using the bodyhandle
  1821. completely incorrectly.
  1822. I<Thanks to Joel Noble for bringing this to my attention.>
  1823.  
  1824. Fixed MIME::Head::VERSION so CPAN:: is happier.
  1825. I<Thanks to Larry Virden for bringing this to my attention.>
  1826.  
  1827. Fixed undefined-variable warnings when dumping skeleton
  1828. (happened when there was no Subject: line)
  1829. I<Thanks to Joel Noble for bringing this to my attention.>
  1830.  
  1831.  
  1832. =item Version 2.02
  1833.  
  1834. B<Stupid, stupid bugs in both BASE64 encoding and decoding were fixed.>
  1835. I<Thanks to Phil Abercrombie for locating them.>
  1836.  
  1837.  
  1838. =item Version 2.01
  1839.  
  1840. B<Modules now inherit from the new Mail:: modules!>
  1841. This means big changes in behavior.
  1842.  
  1843. B<MIME::Parser can now store message data in-core.>
  1844. There were a I<lot> of requests for this feature.
  1845.  
  1846. B<MIME::Entity can now compose messages.>
  1847. There were a I<lot> of requests for this feature.
  1848.  
  1849. Added option to parse C<"message/rfc822"> as a pseduo-multipart document.
  1850. I<Thanks to Andreas Koenig for suggesting this.>
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856. =item Version 1.13
  1857.  
  1858. MIME::Head now no longer requires space after ":", although
  1859. either a space or a tab after the ":" will be swallowed
  1860. if there.
  1861. I<Thanks to Igor Starovoitov for pointing out this shortcoming.>
  1862.  
  1863. =item Version 1.12
  1864.  
  1865. Fixed bugs in parser where CRLF-terminated lines were
  1866. blowing out the handling of preambles/epilogues.
  1867. I<Thanks to Russell Sutherland for reporting this bug.>
  1868.  
  1869. Fixed idiotic is_multipart() bug.
  1870. I<Thanks to Andreas Koenig for noticing it.>
  1871.  
  1872. Added untested binmode() calls to parser for DOS, etc.
  1873. systems.  No idea if this will work...
  1874.  
  1875. Reorganized the output_path() methods to allow easy use
  1876. of inheritance, as per Achim Bohnet's suggestion.
  1877.  
  1878. Changed MIME::Head to report mime_type more accurately.
  1879.  
  1880. POSIX module no longer loaded by Parser if perl >= 5.002.
  1881. Hey, 5.001'ers: let me know if this breaks stuff, okay?
  1882.  
  1883. Added unsupported ./examples directory.
  1884.  
  1885. =item Version 1.11
  1886.  
  1887. Converted over to using Makefile.PL.
  1888. I<Thanks to Andreas Koenig for the much-needed kick in the pants...>
  1889.  
  1890. Added t/*.t files for testing.  Eeeeeeeeeeeh...it's a start.
  1891.  
  1892. Fixed bug in default parsing routine for generating
  1893. output paths; it was warning about evil filenames if
  1894. there simply I<were> no recommended filenames.  D'oh!
  1895.  
  1896. Fixed redefined parts() method in Entity.
  1897.  
  1898. Fixed bugs in Head where field name wasn't being case folded.
  1899.  
  1900. =item Version 1.10
  1901.  
  1902. A typo was causing the epilogue of an inner multipart
  1903. message to be swallowed to the end of the OUTER multipart
  1904. message; this has now been fixed.
  1905. I<Thanks to Igor Starovoitov for reporting this bug.>
  1906.  
  1907. A bad regexp for parameter names was causing
  1908. some parameters to be parsed incorrectly; this has also
  1909. been fixed.
  1910. I<Thanks again to Igor Starovoitov for reporting this bug.>
  1911.  
  1912. It is now possible to get full control of the filenaming
  1913. algorithm before output files are generated, and the default
  1914. algorithm is safer.
  1915. I<Thanks to Laurent Amon for pointing out the problems, and suggesting
  1916. some solutions.>
  1917.  
  1918. Fixed illegal "simple" multipart test file.  D'OH!
  1919.  
  1920. =item Version 1.9
  1921.  
  1922. No changes: 1.8 failed CPAN registration
  1923.  
  1924. =item Version 1.8
  1925.  
  1926. Fixed incompatibility with 5.001 and FileHandle::new_tmpfile
  1927. Added COPYING file, and improved README.
  1928.  
  1929. =back
  1930.  
  1931.  
  1932.  
  1933.  
  1934. =head1 AUTHOR
  1935.  
  1936. MIME-tools was created by:
  1937.  
  1938.     ___  _ _ _   _  ___ _
  1939.    / _ \| '_| | | |/ _ ' /    Eryq, (eryq@zeegee.com)
  1940.   |  __/| | | |_| | |_| |     President, ZeeGee Software Inc.
  1941.    \___||_|  \__, |\__, |__   http://www.zeegee.com/
  1942.              |___/    |___/
  1943.  
  1944. Released as MIME-parser (1.0): 28 April 1996.
  1945. Released as MIME-tools (2.0): Halloween 1996.
  1946. Released as MIME-tools (4.0): Christmas 1997.
  1947. Released as MIME-tools (5.0): Mother's Day 2000.
  1948.  
  1949.  
  1950.  
  1951. =head1 ACKNOWLEDGMENTS
  1952.  
  1953. B<This kit would not have been possible> but for the direct
  1954. contributions of the following:
  1955.  
  1956.     Gisle Aas             The MIME encoding/decoding modules.
  1957.     Laurent Amon          Bug reports and suggestions.
  1958.     Graham Barr           The new MailTools.
  1959.     Achim Bohnet          Numerous good suggestions, including the I/O model.
  1960.     Kent Boortz           Initial code for RFC-1522-decoding of MIME headers.
  1961.     Andreas Koenig        Numerous good ideas, tons of beta testing,
  1962.                             and help with CPAN-friendly packaging.
  1963.     Igor Starovoitov      Bug reports and suggestions.
  1964.     Jason L Tibbitts III  Bug reports, suggestions, patches.
  1965.  
  1966. Not to mention the Accidental Beta Test Team, whose bug reports (and
  1967. comments) have been invaluable in improving the whole:
  1968.  
  1969.     Phil Abercrombie
  1970.     Mike Blazer
  1971.     Brandon Browning
  1972.     Kurt Freytag
  1973.     Steve Kilbane
  1974.     Jake Morrison
  1975.     Rolf Nelson
  1976.     Joel Noble
  1977.     Michael W. Normandin
  1978.     Tim Pierce
  1979.     Andrew Pimlott
  1980.     Dragomir R. Radev
  1981.     Nickolay Saukh
  1982.     Russell Sutherland
  1983.     Larry Virden
  1984.     Zyx
  1985.  
  1986. Please forgive me if I've accidentally left you out.
  1987. Better yet, email me, and I'll put you in.
  1988.  
  1989.  
  1990.  
  1991. =head1 SEE ALSO
  1992.  
  1993. At the time of this writing ($Date: 2001/01/17 06:57:21 $), the MIME-tools homepage was
  1994. F<http://www.zeegee.com/code/perl/MIME-tools>.
  1995. Check there for updates and support.
  1996.  
  1997. Users of this toolkit may wish to read the documentation of Mail::Header
  1998. and Mail::Internet.
  1999.  
  2000. The MIME format is documented in RFCs 1521-1522, and more recently
  2001. in RFCs 2045-2049.
  2002.  
  2003. The MIME header format is an outgrowth of the mail header format
  2004. documented in RFC 822.
  2005.  
  2006.  
  2007. =cut
  2008.