$head->get issues possibly.
"Roderick A. Anderson" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Message-ID | <[email protected]> |
It seems the spammers are breaking more and more Internet rules ... :-)
I've fought and semi-fixed a few blank fields in the message header but
more are appearing. So I'd like some input on whether I'm doing this
correctly. It is based on suggestions I got off the list several months
ago but I could have miss-understood what I was told.
Basically I am opening spam folders and parsing out the Subject, Date,
From, and Size information and placing it in a report to the spam folder
owner.
The problems is the get method on some messages is returning null
values and this causes other code later in the scripts to fail. The short
questions is there a way to have the get methods to return at least an
empty string?
This is a rough outline of how I'm currently doing it
my $mgr = Mail::Box::Manager->new;
my $spam = $mgr->open($file);
foreach my $msg ($spam->messages) {
my $head = $msg->head;
my $from = substr($head->get('From'), 0, 24);
my $subject = $head->get('Subject');
my ($ss,$mm,$hh,$day,$month,$year,$zone) =
...
Currently I'm doing the
$from .= '';
$subject .= '';
$year +=
$hh += 0;
trick to force a value(?). Does this make sense? Is there a slot to
cause Mail-Box to return 'something' for the empty fields so they at least
come back defined?
I am searching the docs but haven't got very far into them yet.
TIA,
Rod
--
"Open Source Software - You usually get more than you pay for..."
"Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL"