Time::Duration::Parse - Parse string that represents time duration
use Time::Duration::Parse; my $seconds = parse_duration("2 minutes and 3 seconds"); # 123
Time::Duration::Parse is a module to parse human readable duration strings like 2 minutes and 3 seconds to seconds.
It does the opposite of duration_exact function in Time::Duration and is roundtrip safe. So, the following is always true.
use Time::Duration::Parse; use Time::Duration; my $seconds = int rand 100000; is( parse_duration(duration_exact($seconds)), $seconds );
$seconds = parse_duration($string);
Parses duration string and returns seconds. When it encounters an error in a given string, it dies an exception saying:
Tatsuhiko Miyagawa <miyagawa@bulknews.net>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Some internal code is taken from Cache and Cache::Cache modules on CPAN.
Date::Manip, http://use.perl.org/~miyagawa/journal/30310
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install Time::Duration::Parse, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Time::Duration::Parse
CPAN shell
perl -MCPAN -e shell install Time::Duration::Parse
For more information on module installation, please visit the detailed CPAN module installation guide.