lig has asked for the wisdom of the Perl Monks concerning the following question:
I am learning how to use the various classes of MIME::Tools. I am getting the hang of it but have recently run into a wall. I am trying to get the Subject header just to display - and it is a no go.
I have made sure to have "use" on all of the modules involved (Parser, Entity, and Head). running with strict, warnings and diagnostics. Nothing in the error logs.
Can anyone see where I am going wrong? I have commented out the the alternate code (though not all of it's variations) I attempted to use so you can see the alternate path I tried.
Update: Solved.eval { # OK here is where we will try to use the MIME::Tools suite of clas +ses # Wish me luck - Hopefully I won't screw it up too much. my $parser = new MIME::Parser; my $entity = $parser->parse_data($email) or die("Bad Parse. "); # Tried this - doesn't work #my $crap = (defined($entity->head->get('subject',0)))?$entity->hea +d->get('Subject',0):'undef'; #$page->p("Subject: $crap<br />\n"); # Also tried this - doesn't work $page->p('Subject: '.$entity->head->get('subject',0)); # The wierd part - this does work. Even when the other # parts are still in $page->p($entity->head->print()); }; if ($@) { print $page -> p("Error occured $@ \n"); }
I am an idiot. Finally figured out what was going wrong. I forgot to print the stupid $page->p. Just shoot me
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: trouble with MIME::Tools
by McD (Chaplain) on Oct 24, 2005 at 11:53 UTC | |
|
Re: trouble with MIME::Tools
by GrandFather (Saint) on Oct 24, 2005 at 09:13 UTC | |
by lig (Acolyte) on Oct 24, 2005 at 12:29 UTC | |
by GrandFather (Saint) on Oct 24, 2005 at 18:35 UTC |