Re: $head->get issues possibly.

Mark Overmeer <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.mail-box
Organization MARKOV Solutions
Message-ID <[email protected]>
* David A Golden ([email protected]) [040406 06:21]:
> My suggestion is to either return it as a string and make explicit warnings 
> in the docs that it may or may not be valid, or else try to return a 
> DateTime object.  Or maybe both.  E.g. date() returns the string and 
> datetime() returns a DateTime object.  Look at DateTime::Format::Mail and 
> see if that will do well enough for getting the string to a standard 
> date.  It has a "loose" parsing setting, but dies if unparseable so needs 
> to be wrapped in an eval block.  Other DateTime::Format modules, e.g. 
> ::Strptime, might work as well.

In stead of a "DateTime" object to return, I choose for a timestamp
value, which can be used immediately in all kind of formatting and
calculations.  The things are handled in
  Mail::Message::Field::dateToTimestamp()
calling Date::Parse::str2time.  That funtion is really flexible in
accepting formats.  For reading that's ok: be as flexible as you can
in accepting information, and as strict to the RFCs when you produce it.
-- 
               MarkOv

------------------------------------------------------------------------
drs Mark A.C.J. Overmeer                                MARKOV Solutions
       [email protected]                          [email protected]
http://Mark.Overmeer.net                   http://solutions.overmeer.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.