Matts-Message-Parser
view release on metacpan or search on metacpan
lib/Matts/Message/Parser.pm view on Meta::CPAN
package Matts::Message::Parser;
use strict;
use vars qw(@Try_Encodings $VERSION);
$VERSION = '1.0';
# MIME Message parser, for email and nntp engines.
use Matts::Message;
use MIME::Base64;
use MIME::QuotedPrint;
use Carp;
use UNIVERSAL;
@Try_Encodings = qw(euc-cn euc-jp shiftjis euc-kr big5-eten iso-8859-15 );
sub debug {
return unless $ENV{DEBUG};
warn((caller)[2], @_);
}
sub mkbinmode {
if ($] > 5.007) {
binmode($_[0], ':utf8');
}
else {
binmode($_[0]);
}
}
=head1 NAME
Matts::Message::Parser - a MIME message parser for email and nttp
=head1 SYNOPSIS
use Matts::Message::Parser;
open(my $fh, "foo.eml");
my $msg = Matts::Message::Parser->parse($fh);
=head1 DESCRIPTION
This is an email parser I originally wrote when I ran my own business that tries
quite hard to decode the various parts of an email correctly and down to unicode
so that all strings can be treated the same in perl.
DO NOT USE THIS MODULE
I urge you, please don't. It's not a very good API. I'm just uploading it to
CPAN because it's better for my purposes than most of the Email::* and Mail::*
classes I can find, and it's fast, and doesn't use any memory when parsing very
large emails, which is a huge bonus for me. But I have no intention of documenting
this module any more than I have to.
=head1 AUTHOR
Matt Sergeant, <matt@sergeant.org>
=head1 LICENSE
This is free software. You may use it and redistribute it under the same terms
as perl itself.
=head1 HACKING NOTES
=head2 This is how mail messages can come in:
=over 4
=item 1. Plain text
Plain text messages come in with a content-type of text/plain. They
may contain attachments as UU Encoded strings.
=item 2. HTML text
Straight HTML messages come in with a content-type of text/html. They
may not contain attachments as far as I'm aware.
( run in 0.900 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )