Amon2-CLI
view release on metacpan or search on metacpan
lib/Amon2/CLI.pm view on Meta::CPAN
=head3 base
The base class name
=head3 on_error
The code ref for handling error
=head3 before_run
The code ref which is invoked before running main method
=head3 after_run
The code ref which is invoked after running main method
=head3 method // 'main'
The name of method in class for script
=head3 run_method // 'run'
The name of method on $c for invoking CLI script
=head3 getopt // [qw/:config posix_default no_ignore_case gnu_compat/]
The options string for L<Getopt::Long>
=head3 cli_opt_key
The key string for keeping CLI options in context
=head2 Handling CLI Options
By default, you can get CLI options '--baz' like below
sub main {
my ($class, $c) = @_;
my $opt;
$c->parse_opt(
'baz' => \$opt->{baz},
)->setopt($opt);
print 'OK!' if $c->getopt('baz');
}
B<parse_opt> method requires hash arguments which is same as GetOptions arguments of L<Getopt::Long>.
B<setopt> method sets an argument in context.
B<getopt> method gets a value of options. To get all options when you call C<getopt> method without args.
=head1 REPOSITORY
=begin html
<a href="http://travis-ci.org/bayashi/Amon2-CLI"><img src="https://secure.travis-ci.org/bayashi/Amon2-CLI.png?_t=1451892884"/></a> <a href="https://coveralls.io/r/bayashi/Amon2-CLI"><img src="https://coveralls.io/repos/bayashi/Amon2-CLI/badge.png?_t=...
=end html
Amon2::CLI is hosted on github: L<http://github.com/bayashi/Amon2-CLI>
I appreciate any feedback :D
=head1 AUTHOR
Dai Okabayashi E<lt>bayashi@cpan.orgE<gt>
=head1 SEE ALSO
L<Amon2::Plugin::CLI>
L<Amon2>
=head1 LICENSE
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
=cut
( run in 3.702 seconds using v1.01-cache-2.11-cpan-df04353d9ac )