Stories
Slash Boxes
Comments

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

miyagawa (1653)

miyagawa
  (email not shown publicly)
http://bulknews.vox.com/
AOL IM: bulknews (Add Buddy, Send Message)

Journal of miyagawa (1653)

Monday July 17, 2006
04:31 AM

Time:Duration::Parse

[ #30310 ]

lazyweb,

do you know if there's a module to parse human readable duration format into seconds, like:

    is( parse_duration("3 seconds"), 3 );
    is( parse_duration("7 days, 5 hours"), 622800 );

I want to allow users of Plagger to write things like:

    fresh: 7 days

in YAML config file, to say "I want fresher entries than 7 days old".

So it's kind of opposite to what Time::Duration does. I know there's DateTime::Format::Duration but it looks like you have to explicitly specify which format you expect and that's not what I want.

Cache::BaseCache module has internally a similar code that I want. Do you think it's worth splitting the functionality to a separate module?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.