Help language development. Donate to The Perl Foundation

Getopt::Subcommands cpan:LEONT last updated on 2022-12-01

Getopt-Subcommands-0.1.0/

Build Status

NAME

Getopt::Subcommands - A Getopt::Long extension for subcommands

SYNOPSIS

use Getopt::Subcommands;

sub frobnicate(*@files, Bool :$dry-run) is command { ... }

sub unfrobnicate(:$fuzzy) is command { ... }

sub other($subcommand?, *@args) is fallback { ... }

DESCRIPTION

Getopt::Subcommands is an extension to Getopt::Long that facilitates writing programs with multiple subcommands. It dispatches based on the first argument.

It can be used by using two traits on the subs: is command and is fallback. The former can optionally take the name of the subcommand as an argument, but will default to the name of the sub. The latter will be called if no suitable subcommand can be found or if none is given.

AUTHOR

Leon Timmermans [email protected]

COPYRIGHT AND LICENSE

Copyright 2019 Leon Timmermans

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.