Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### In your base class
- package MyApp;
- use MooseX::App qw(Config Color);
- # Add config file and color-output plugin
- option 'global_option' => (
- is => 'rw',
- isa => 'Bool',
- documentation => q[Enable this to do fancy stuff],
- );
- # Will not be exposed to the CLI
- has 'private_accessor' => (
- is => 'rw',
- );
- ### Write multiple command classes:
- package MyApp::SomeCommand;
- use MooseX::App::Command;
- extends qw(MyApp); # optional
- option 'some_option' => (
- is => 'rw',
- isa => 'Str',
- documentation => q[Very important option!],
- cmd_aliases => [qw(another)],
- );
- sub run {
- my ($self) = @_;
- # Do something
- }
- =pod
- =head1 NAME
- MyApp::SomeCommand - Some description
- =head1 DESCRIPTION
- A longer description
- =cut
- ### And then in some simple wrapper script:
- #!/usr/bin/env perl
- use MyApp;
- MyApp->new_with_command->run;
Add Comment
Please, Sign In to add comment