Joe McMahon > Date-PeriodParser > Date::PeriodParser

Download:
Date-PeriodParser-0.17.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.17   Source  

NAME ^

Date::PeriodParser - Turns English descriptions into time periods

SYNOPSIS ^

  use Date::PeriodParser;
  my ($midnight, $midday) = parse_period("this morning");
  my ($monday_am, $sunday_pm) = parse_period("this week");
  ... parse_period("sometime this afternoon");
  ... parse_period("around two weeks ago");

DESCRIPTION ^

Date::PeriodParser provides a means of interpreting vague descriptions of dates as actual, meaningful date values by taking a shot at interpreting the meaning of the supplied descriptive phrase, generating a best-guess before-and-after estimate of the time period described.

ROUTINES ^

parse_period

The subroutine parse_period attempts to turn an English description of a time period into a pair of Unix epoch times. As a famous man once said, "Of course, this is a heuristic, which is a fancy way of saying that it doesn't work".

WHAT'S CURRENTLY SUPPORTED ^

If you enter something it can't parse, it'll return an error code and an explanation instead of two epoch time values. Error code -1 means "You entered gibberish", error code -2 means "you entered something ambiguous", and the explanation will tell you how to disambiguate it.

DEPENDENCIES ^

BUGS ^

AUTHOR ^

Simon Cozens, simon@cpan.org Joe McMahon, mcmahon@cpan.org Major contributions by Michael Hendrix (mndrix@cpan.org) (Thanks!)

LEGAL ^

Copyright (C) 2002 by Simon Cozens; Copyright (c) 2005-2013 by Joe McMahon

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: