Skip to content

Instantly share code, notes, and snippets.

@bdonlan
Created July 19, 2009 15:37
Show Gist options
  • Save bdonlan/149944 to your computer and use it in GitHub Desktop.
Save bdonlan/149944 to your computer and use it in GitHub Desktop.
my $gs = Getopt::String->new({
# --
"" => sub { $_[0]->stop(); },
# --help
help => sub { print $usage; exit 1; },
# --verbose[=n]
verbose => sub {
$verbosity = $_[0]->arg("Int", 1); # moose types. Second parameter is default
},
# --output filename
output => sub {
$outfile = $_[0]->arg("Str"); # undef fails Str validation
},
o => "output", # alias
});
my $remain = $gs->parse("...");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment