{"id":15514659,"url":"https://github.com/fgasper/p5-cli-popt","last_synced_at":"2026-01-27T13:34:20.940Z","repository":{"id":63543860,"uuid":"568482141","full_name":"FGasper/p5-CLI-Popt","owner":"FGasper","description":"CPAN’s CLI::Popt","archived":false,"fork":false,"pushed_at":"2022-11-30T16:12:58.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T20:51:08.047Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"XS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FGasper.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-20T17:09:46.000Z","updated_at":"2022-11-20T18:37:01.000Z","dependencies_parsed_at":"2023-01-23T19:00:51.231Z","dependency_job_id":null,"html_url":"https://github.com/FGasper/p5-CLI-Popt","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGasper%2Fp5-CLI-Popt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGasper%2Fp5-CLI-Popt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGasper%2Fp5-CLI-Popt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGasper%2Fp5-CLI-Popt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FGasper","download_url":"https://codeload.github.com/FGasper/p5-CLI-Popt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246085655,"owners_count":20721213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T10:00:21.933Z","updated_at":"2026-01-27T13:34:20.893Z","avatar_url":"https://github.com/FGasper.png","language":"XS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nCLI::Popt - Parse CLI parameters via [popt](https://github.com/rpm-software-management/popt)\n\n# SYNOPSIS\n\n    my $popt = CLI::Popt-\u003enew(\n        [\n\n            # A simple boolean:\n            { long_name =\u003e 'help' },\n\n            # Customize the boolean’s truthy value:\n            {\n                long_name =\u003e 'gotta-be-me',\n                type =\u003e 'val',\n                val =\u003e 42,\n            },\n        ],\n        name =\u003e $0,     # default; shown just for demonstration\n    );\n\n    my ($opts_hr, @leftovers) = $popt-\u003eparse(@ARGV);\n\n    if ($opts_hr-\u003e{'help'}) {\n        print $popt-\u003eget_help();\n        exit;\n    }\n\n… and so on.\n\n# DESCRIPTION\n\n[Getopt::Long](https://metacpan.org/pod/Getopt%3A%3ALong) is nice, but its inability to auto-generate help \u0026 usage\ntext requires you to duplicate data between your code and your script’s\ndocumentation.\n\n[popt](https://github.com/rpm-software-management/popt) remedies that problem.\nThis module makes that solution available to Perl.\n\n# CHARACTER ENCODING\n\nAll strings into \u0026 out of this library are byte strings. Please\ndecode/encode according to your application’s needs.\n\n# METHODS\n\n## $obj = _CLASS_-\u003enew( \\\\@OPTIONS, %EXTRA )\n\nInstantiates _CLASS_.\n\nEach @OPTIONS member is a reference to a hash that describes an option\nthat the returned $obj will `parse()` out:\n\n- `long_name` (required)\n- `type` - optional; one of: `none` (default), `string`,\n`argv` (i.e., an array of strings), `short`, `int`, `long`, `longlong`,\n`float`, or `double`\n- `short_name` - optional\n- `flags` - optional arrayref of `onedash`, `doc_hidden`,\n`optional`, `show_default`, `random`, and/or `toggle`.\n\n    Numeric options may also include `or`, `and`, or `xor`, and optionally\n    `not`.\n\n    NB: not all flags make sense together; e.g., `or` conflicts with `xor`.\n\n    See [popt(3)](http://man.he.net/man3/popt) for more information.\n\n- `descrip`, and `arg_descrip` - optional, as described in\n[popt(3)](http://man.he.net/man3/popt).\n\n%EXTRA is:\n\n- `name` - defaults to Perl’s `$0`. Give empty string\nto leave this unset.\n\n## ($opts\\_hr, @leftovers) = _OBJ_-\u003eparse(@ARGV)\n\nParses a list of strings understood to be parameters to script\ninvocation. Returns a hash reference of the parsed options (keyed\non each option’s `long_name`) as well as a list of “leftover” @ARGV members\nthat didn’t go into one of the parsed options.\n\nIf @ARGV doesn’t match _OBJ_’s stored options specification (e.g.,\n[popt(3)](http://man.he.net/man3/popt) fails the parse), an appropriate exception of type\n[CLI::Popt::X::Base](https://metacpan.org/pod/CLI%3A%3APopt%3A%3AX%3A%3ABase) is thrown.\n\n## $str = _OBJ_-\u003eget\\_help()\n\nReturns the help text.\n\n## $str = _OBJ_-\u003eget\\_usage()\n\nReturns the usage text.\n\n# LICENSE \u0026 COPYRIGHT\n\nCopyright 2022 by Gasper Software Consulting. All rights reserved.\n\nThis library is licensed under the same terms as Perl itself.\nSee [perlartistic](https://metacpan.org/pod/perlartistic).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgasper%2Fp5-cli-popt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffgasper%2Fp5-cli-popt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgasper%2Fp5-cli-popt/lists"}