rev 1421 - trunk/mariachi/lib/Mariachi

[prev] [thread] [next] [lurker] [Date index for 2003/10/16]

From: richardc
Subject: rev 1421 - trunk/mariachi/lib/Mariachi
Date: 10:03 on 16 Oct 2003
Author: richardc
Date: 2003-10-16 10:03:01 +0100 (Thu, 16 Oct 2003)
New Revision: 1421

Modified:
   trunk/mariachi/lib/Mariachi/Message.pm
Log:
well now it runs through

Modified: trunk/mariachi/lib/Mariachi/Message.pm
===================================================================
--- trunk/mariachi/lib/Mariachi/Message.pm	2003-10-16 08:56:27 UTC (rev 1420)
+++ trunk/mariachi/lib/Mariachi/Message.pm	2003-10-16 09:03:01 UTC (rev 1421)
@@ -10,19 +10,15 @@
 use base 'Mariachi::DBI';
 __PACKAGE__->set_up_later(
     rawmail         => 'Email::Simple',
-    hdr_message_id  => '',
-    hdr_from        => '',
-    hdr_subject     => '',
-    hdr_date        => '',
-    hdr_references  => '',
-    hdr_in_reply_to => '',
-    body            => '',
-    epoch_date      => '',
+    map { $_ => '' } qw(
+        hdr_message_id hdr_from hdr_subject hdr_date
+        hdr_references hdr_in_reply_to
+        body epoch_date day month year ),
    );
 __PACKAGE__->add_trigger( before_create => \&pre_create );
 
 #these are just sops
-__PACKAGE__->columns( TEMP => qw( prev next root day month year ) );
+__PACKAGE__->columns( TEMP => qw( prev next root ) );
 
 # copy things out of the email::simple message and into the columns
 sub _blat {
@@ -40,6 +36,12 @@
 
     $data->{body}       = $mail->body;
     $data->{epoch_date} = str2time( $data->{hdr_date} ) || 0;
+
+    my @date = localtime $data->{epoch_date};
+    my @ymd = ( $date[5] + 1900, $date[4] + 1, $date[3] );
+    $data->{day}   = sprintf "%04d/%02d/%02d", @ymd;
+    $data->{month} = sprintf "%04d/%02d", @ymd;
+    $data->{year}  = sprintf "%04d", @ymd;
 }
 
 =head1 NAME

Generated at 13:57 on 01 Jul 2004 by mariachi 0.52