This is going to the two lists as I'm not sure where the problem is.  
A run through the perl debugger leaves me still wondering. 

I have a just moved a script to a new system and during the process 
upgraded all (I hope) the modules needed.  The new system is Redhat 
Linux 8.0.  This includes perl 5.8.  The modules I'm using are:

use Mail::Box::Manager;
use Date::Parse;
use MIME::Entity;
use DateTime::Format::Mail;
use Date::Calc qw(Delta_Days Parse_Date);

This script reads a bunch of mbox files pulling subject, date/time and 
size information and creating a report (spam.mbx from Declude/iMail).

After I moved the script I am now suddenly getting a timezone out of 
range error with a value of -3.

I'm using a rather hodge-podge collection of functions from the 
above modules to pry the information out of a bunch of poorly formatted 
messages - spam, go figure eh?.

I get the timezone and time using this line

        my ($ss,$mm,$hh,$day,$month,$year,$zone) =
            strptime($head->get('date'));

Then because it's spam I use this to get a hopefully good date.

        ($year, $month, $day) = Parse_Date($msg->fromLine);

After this I pound and cuss at the values until I get something valid.  
For the zone I use:

        if ($zone) {

            if ($zone =~ /^[+-]?\d+$/) {
                $zone = int($zone/3660);
            }

        } else {

            $zone = '-0800';
        }

And with one message I'm getting a -3 back and the script is erroring.  
Did something I miss change in DateTime or Mail::Box change in the 
handling of the zone?

FWIW this is the fragment that is croaking.

But first.

        my $today = DateTime->today;

Then lines later.

        $delta_days = eval {
            Delta_Days($year, $month, $day,
                       $today->year, $today->month, $today->day)};

        if ($@) {

            $msgdate = DateTime->new
                (year => $year, month => $month, day => $day,
                 hour => $hh, minute => $mm, second => $ss,
                 time_zone => $zone
                 );

            $head->set('Date' =>
                       DateTime::Format::Mail->format_datetime($msgdate));

            $delta_days = 0;

        } else {

            $msgdate = DateTime->new
                (year => $year, month => $month, day => $day,
                 hour => $hh, minute => $mm, second => $ss,
                 time_zone => $zone
                 );
        };


Please point me in the right direction.

BTW, several of you helped me some months ago to sort out the malformed 
message header problems and the solutions so I was quite surprised with 
this error.


TIA,
Rod
-- 
  "Open Source Software - Sometimes you get more than you paid for..."

Reply via email to