NAME

Getopt::Pad::Type::Int - The int option type

SYNOPSIS

options => {
    workers => { type => 'int', min => 1, max => 64, default => 4 },
    id      => { type => 'int', bigint => 1 },
},

DESCRIPTION

The type of options and args declared with type => 'int', 'integer' or 'i'.

It accepts an optional + or -, followed by one or more decimal digits: 42, -7, +3, 007. The reader returns the value as a number, so 007 reads as 7. Anything else is rejected with 'VALUE' is not an integer, and a value outside the range of Perl's integers (from -2**63 to 2**64-1 on a 64-bit perl), which Perl could only hold as a rounded float, with 'VALUE' is too large for an integer.

With the spec key bigint, values of any size are accepted and the reader returns a Math::BigInt object, loaded only for such options. The bounds min and max must then be integers (min must be an integer with bigint, not 'VALUE') and are compared exactly.

The spec keys min and max set inclusive bounds; they come from Getopt::Pad::Type::Number. See "int" in Getopt::Pad for the user-level description.

SEE ALSO

"TYPES" in Getopt::Pad, Getopt::Pad::Type::Float, Getopt::Pad::Type::Number

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.