NAME
Getopt::Pad::Type::Duration - The duration option type
SYNOPSIS
options => {
timeout => { type => 'duration', default => '90 minutes' },
},
DESCRIPTION
The type of options and args declared with type => 'duration'. It parses a length of time, one number and one unit with an optional leading for, such as 90 minutes, 2 weeks, 1 month or for 3 hours, with DateTime::Format::Natural. That module is not installed together with Getopt::Pad (see Getopt::Pad::Type::Temporal). Abbreviations (1h) and combinations (1 hour 30 minutes) are rejected with 'VALUE' is not a duration.
The reader returns a DateTime::Duration object. It is measured from the current time in the time zone of the timezone key, which makes a difference only when the length spans a daylight saving change. The help output labels the option [Duration].
The behavior for users is described in "duration" in Getopt::Pad.
SEE ALSO
"TYPES" in Getopt::Pad, Getopt::Pad::Type::Temporal, Getopt::Pad::Type::Date
AUTHOR
davenonymous <perl@davenonymous.com>
COPYRIGHT AND LICENSE
Copyright 2026 davenonymous
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.