in reply to Mail::Field Help Needed

windows/AS 5.8

After installing Mail::Field::Received using ppm and using the examples in the synopsis I got the following.

#!/usr/local/bin/perl use strict; use warnings; use Mail::Field; my $header = q{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 VAA +24164 for <adam@spiers.net>; Tue, 1 Feb 2000 21:57:18 -0500}; print qq{header: $header\n}; my $received = Mail::Field->new(q{Received}, $header); my $results = $received->parse_tree(); # hangs perl #if ($received->parse_ok){ # print qq{parse ok\n}; #} #else{ # print qq{parse not ok\n}; #} print qq{by -> domain: $results->{by}{domain}\n};
outputs
header: from tr909.mediaconsult.com (mediacons.tecc.co.uk [193.128.6.1 +32]) by host5.hostingcheck.com (8.9.3/8.9.3) with ESMTP id VAA24164 f +or <adam@spiers.net>; Tue, 1 Feb 2000 21:57:18 -0500 by -> domain: host5.hostingcheck.com
On my setup the $received->parse_ok method hung perl (see update) but the $received->parse_tree worked. I haven't had a chance to look at the source to identify why.

update: see broomduster's reply pointing out my typo that caused the error.

Replies are listed 'Best First'.
Re^2: Mail::Field Help Needed
by broomduster (Priest) on Sep 01, 2008 at 13:12 UTC
    I had a few minutes to spare, so I thought I'd have a go at this. After banging my head for more than just a few minutes, I finally noticed...

    The method is parsed_ok (note the 'd'). With that change, your code works for me. Hopefully it will for the OP, as well.

      broomduster++

      That fixed it, I was clearly not fully awake.

      Many thanks

Re^2: Mail::Field Help Needed
by gw1500se (Beadle) on Sep 01, 2008 at 19:45 UTC
    Interesting. I've abandoned 'parse_tree' because for me it goes into a loop saying the function was depreciated. Also the documentation said I should not normally be calling those functions directly but rather via Mail::Field and in this case, 'parse()'.