#!/usr/bin/env perl
use Benchmark qw( timethese );
use Courriel;
use Email::MIME;
my $text = <<'EOF';
From autarch@gmail.com Sun May 29 11:22:29 2011
MIME-Version: 1.0
Date: Sun, 29 May 2011 11:22:22 -0500
Message-ID: <BANLkTimjF2BDbOKO_2jFJsp6t+0KvqxCwQ@mail.gmail.com>
Subject: Testing
From: Dave Rolsky <autarch@gmail.com>
To: Dave Rolsky <autarch@urth.org>
Content-Type: multipart/alternative; boundary=20cf3071cfd06272ae04a46c9306
--20cf3071cfd06272ae04a46c9306
Content-Type: text/plain; charset=ISO-8859-1
This is a test email.
It has some *bold* text.
--20cf3071cfd06272ae04a46c9306
Content-Type: text/html; charset=ISO-8859-1
This is a test email.<br><br>It has some <b>bold</b> text.<br><br>
--20cf3071cfd06272ae04a46c9306--
EOF
sub courriel {
my $copy = $text;
Courriel->parse( text => \$copy );
}
sub email_mime {
my $copy = $text;
Email::MIME->new(\$copy);
}
timethese(
5000, {
Courriel => \&courriel,
'Email::MIME' => \&email_mime,
}
);