Mail-Field-Received
view release on metacpan or search on metacpan
#!/usr/bin/perl -w
use warnings;
use strict;
use Test::More tests => 16;
use Test::Differences;
sub parse_tree_ok {
my ($received, $expect, $name) = @_;
eq_or_diff $received->parse_tree, $expect, $name
or note $received->diagnostics;
}
BEGIN { use_ok('Mail::Field::Received'); }
my $received = Mail::Field->new('Received');
isa_ok $received, 'Mail::Field::Received';
is $received->tag, 'Received', 'tag';
$received->debug(5);
is $received->debug, 5, 'debug level';
# date format 3
my $in =
'from tr909.mediaconsult.com (mediacons.tecc.co.uk [193.128.6.132]) by host5.hostingcheck.com (8.9.3/8.9.3) with ESMTP id VAA24164 for <adam@spiers.net>; Tue, 1 Feb 2000 21:57:18 -0500';
my $parse_tree = {
'by' => {
'domain' => 'host5.hostingcheck.com',
'whole' => 'by host5.hostingcheck.com',
'comments' => ['(8.9.3/8.9.3)'],
},
'date_time' => {
'year' => '2000',
'week_day' => 'Tue',
'minute' => '57',
'day_of_year' => '1 Feb',
'month_day' => ' 1',
'zone' => '-0500',
'second' => '18',
'hms' => '21:57:18',
'date_time' => 'Tue, 1 Feb 2000 21:57:18 -0500',
'hour' => '21',
'month' => 'Feb',
'rest' => '2000 21:57:18 -0500',
'whole' => 'Tue, 1 Feb 2000 21:57:18 -0500'
},
'with' => {
'with' => 'ESMTP',
'whole' => 'with ESMTP'
},
'from' => {
'domain' => 'mediacons.tecc.co.uk',
'HELO' => 'tr909.mediaconsult.com',
'from' => 'tr909.mediaconsult.com',
'address' => '193.128.6.132',
'comments' => [ '(mediacons.tecc.co.uk [193.128.6.132])', ],
'whole' =>
'from tr909.mediaconsult.com (mediacons.tecc.co.uk [193.128.6.132])
'
},
'id' => {
'id' => 'VAA24164',
'whole' => 'id VAA24164'
},
'comments' => [ '(mediacons.tecc.co.uk [193.128.6.132])', '(8.9.3/8.9.3)' ],
'for' => {
'for' => '<adam@spiers.net>',
'whole' => 'for <adam@spiers.net>'
( run in 2.238 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )