App-Chained
view release on metacpan or search on metacpan
lib/App/Chained.pm view on Meta::CPAN
{
# a subroutine reference called to run the sub command
# This is a simple wrapper. You don't have to change your modules or scripts
# or inherite from any class
my ($self, $command, $arguments) = @_ ;
system 'your_executable ' . join(' ', @{$arguments}) ;
},
help => sub {system "your_executable --help"}, # a sub to be run when help required
apropos => [qw(verify check error test)], # a list of words to match a user apropos query
options => sub{ ...}, # See generate_bash_completion below
},
...
}
=head1 EXAMPLE
L<App::Requirement::Arch> (from version 0.02) defines a front end application B<ra> to quite a few sub commands. Check the source
of the B<ra> script for a real life example with sub command completion script.
lib/App/Chained.pm view on Meta::CPAN
{
description => 'does a check',
run =>
sub
{
my ($self, $command, $arguments) = @_ ;
system 'ra_check.pl ' . join(' ', @{$arguments}) ;
},
help => sub {system "ra_check.pl --help"},
apropos => [qw(verify check error test)],
options => sub{ ...},
},
},
=back
I<Returns> - An App::Chained object
I<Exceptions> - Dies if an invalid argument is passed
( run in 0.471 second using v1.01-cache-2.11-cpan-39bf76dae61 )