MooseX::Getopt
- glue your class to the command-line
package Class;
with 'MooseX::Getopt';
has $_ for qw/foo bar baz/;
sub run { say "$_: ", $self->$_ for qw/foo bar baz/ }
- in a script:
#!/usr/bin/env perl Class->new_with_options->run;
- running it
$ my_script.pl --foo 42 --bar Hello --baz 123 foo: 42 bar: Hello baz: 123