| 1 | # You may distribute under the terms of either the GNU General Public License | ||||||||||
| 2 | # or the Artistic License (the same terms as Perl itself) | ||||||||||
| 3 | # | ||||||||||
| 4 | # (C) Paul Evans, 2016 -- leonerd@leonerd.org.uk | ||||||||||
| 5 | |||||||||||
| 6 | package App::MatrixTool::SubCommands; | ||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use base qw( App::MatrixTool ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 1 | ▶ | use constant ARGUMENTS => ( "command", "..." ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | sub run | ||||||||||
| 15 | { | ||||||||||
| 16 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
run: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 17 | 0 | my @args = @_; | |||||||||
| 18 | |||||||||||
| 19 | 0 | my $cmd = shift @args; | |||||||||
| 20 | |||||||||||
| 21 | 0 | my $pkg = $self->_pkg_for_command( $cmd ); | |||||||||
| 22 | 0 | ▶ | $pkg->can( "new" ) or | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | return $self->error( "No such command '$cmd'" ); | ||||||||||
| 24 | |||||||||||
| 25 | # TODO: ponder global opts? | ||||||||||
| 26 | 0 | my $runner = $pkg->new( %$self ); | |||||||||
| 27 | |||||||||||
| 28 | 0 | $self->run_command_in_runner( $runner, @args ); | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 1 | 0x55AA; | |||||||||