Perl module for parsing natural language time duration specifications (similar to the "at" command)?

Posted by Ryan Thompson on Stack Overflow See other posts from Stack Overflow or by Ryan Thompson
Published on 2010-06-04T20:11:55Z Indexed on 2010/06/05 8:22 UTC
Read the original article Hit count: 183

Filed under:
|
|
|

I'm writing a perl script that takes a "duration" option, and I'd like to be able to specify this duration in a fairly flexible manner, as opposed to only taking a single unit (e.g. number of seconds). The UNIX at command implements this kind of behavior, by allowing specifications such as "now + 3 hours + 2 days". For my program, the "now" part is implied, so I just want to parse the stuff after the plus sign. (Note: the at command also parses exact date specifications, but I only want to parse durations.)

Is there a perl module for parsing duration specifications like this? I don't need the exact syntax accepted by at, just any reasonable syntax for specifying time durations.


Edit: Basically, I want something like DateTime::Format::Flexible for durations instead of dates.

© Stack Overflow or respective owner

Related posts about perl

Related posts about parsing