NAME
Getopt::Pad::Util - Helper functions (internal)
DESCRIPTION
This module is internal to Getopt::Pad. It is not part of the public API and can change without notice. Programs use "GetOptions" in Getopt::Pad; this page is for people working on Getopt::Pad itself.
FUNCTIONS
All functions are exported on request.
- camelize($name)
-
The reader name for an option or arg name: split at dashes and underscores, every part after the first with its first letter upper case (
log-levelbecomeslogLevel). A spec error if the result is not a valid Perl identifier. - isValidName($name)
-
Whether
$nameis a valid option name, alias, arg name or command name: a letter, followed by word characters or dashes. - optionSpelling($name)
-
An option name as it is typed:
-vfor a name of one letter, else--verbose. - specError($format, @args)
-
Dies with
Getopt::Pad spec: MESSAGE at FILE line LINE., where FILE and LINE are those of the first caller outside Getopt::Pad, normally theGetOptionscall.$!and$?are cleared first, so an uncaught spec error exits with status 255. - scalarsIn($value)
-
Every single value in
$value: the value itself, or the scalars of a list, a mapping or a list of mappings. - processedWith($callback, $result, $value)
-
$valuewith every single value in it replaced by$callback->($result, $single); arrayrefs and hashrefs around them are rebuilt in the same shape.undefand a missing$callbackleave the value as it is. Options and args use it forprocessValue. - decodedWord($word)
-
A command line word as a character string: decoded from UTF-8 unless it is decoded already or is not valid UTF-8, in which case it is returned as it is.
- encodedFor($handle, $text)
-
$textas it is printed on$handle: encoded as UTF-8 when it holds characters and the handle has no encoding layer, else unchanged. - expandTilde($path)
-
Replaces a leading
~(alone or followed by/) with$HOME. Returns the path unchanged whenHOMEis not set. - useColor($handle)
-
Whether output to
$handleshould be colored: it is a terminal,NO_COLORis empty or unset, andTERMis notdumb.
SEE ALSO
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.