App-DateUtils
view release on metacpan or search on metacpan
script/parse-duration view on Meta::CPAN
# ABSTRACT: Parse duration string(s) using one of several modules
# PODNAME: parse-duration
__END__
=pod
=encoding UTF-8
=head1 NAME
parse-duration - Parse duration string(s) using one of several modules
=head1 VERSION
This document describes version 0.128 of parse-duration (from Perl distribution App-DateUtils), released on 2024-03-07.
=head1 SYNOPSIS
B<parse-duration> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)
B<parse-duration> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)
B<parse-duration> [B<L<--all-modules|/"--all-modules, -a">>|B<L<-a|/"--all-modules, -a">>] [B<L<--format|/"--format=s">>=I<name>|B<L<--json|/"--json">>] [B<L<--module|/"--module=s, -m">>=I<str>|B<L<-m|/"--module=s, -m">>=I<str>] [B<L<--(no)naked-res|...
=head1 OPTIONS
C<*> marks required options.
=head2 Main options
=over
=item B<--all-modules>, B<-a>
Parse using all installed modules and return all the result at once.
=item B<--duration>=I<s@>*
(No description)
Can also be specified as the 1st command-line argument and onwards.
Can be specified multiple times.
=item B<--durations-json>=I<s>
See C<--duration>.
Can also be specified as the 1st command-line argument and onwards.
=item B<--module>=I<s>, B<-m>
Default value:
"Time::Duration::Parse"
Valid values:
["DateTime::Format::Natural","Time::Duration::Parse"]
=back
=head2 Output options
=over
=item B<--format>=I<s>
Choose output format, e.g. json, text.
Default value:
undef
Output can be displayed in multiple formats, and a suitable default format is
chosen depending on the application and/or whether output destination is
interactive terminal (i.e. whether output is piped). This option specifically
chooses an output format.
=item B<--json>
Set output format to json.
=item B<--naked-res>
When outputing as JSON, strip result envelope.
Default value:
0
By default, when outputing as JSON, the full enveloped result is returned, e.g.:
[200,"OK",[1,2,3],{"func.extra"=>4}]
The reason is so you can get the status (1st element), status message (2nd
element) as well as result metadata/extra result (4th element) instead of just
the result (3rd element). However, sometimes you want just the result, e.g. when
you want to pipe the result for more post-processing. In this case you can use
C<--naked-res> so you just get:
[1,2,3]
=item B<--page-result>
Filter output through a pager.
This option will pipe the output to a specified pager program. If pager program
is not specified, a suitable default e.g. C<less> is chosen.
=item B<--view-result>
View output using a viewer.
This option will first save the output to a temporary file, then open a viewer
program to view the temporary file. If a viewer program is not chosen, a
( run in 1.075 second using v1.01-cache-2.11-cpan-39bf76dae61 )