SYNOPSIS use Time::Duration::Parse::AsHash; my $res = parse_duration("2 minutes and 3 seconds"); # => {minutes=>2, seconds=>3} DESCRIPTION Time::Duration::Parse::AsHash is like Time::Duration::Parse except: * It returns a hashref of parsed duration elements instead of number of seconds There are some circumstances when you want this, e.g. when feeding into DateTime::Duration and you want to count for leap seconds. * Seconds are not rounded by default For example: "0.1s" or 100ms will return result { seconds => 0.1 }. Also, in addition to 01:02:03 being recognized as 1h2min3s, 01:02:03.4567 will also be recognized as 1h2min3.4567s. * Extra elements recognized milliseconds (or ms). This will be returned in seconds key. microseconds. This will also be returned in seconds key. nanoseconds (or ns). This will also be returned in seconds key. decades. This will be returned in years key. FUNCTIONS parse_duration(str) => hash Parses duration string and returns hash. This function is exported by default. SEE ALSO Time::Duration::Parse